Cvs code -
- General
- New global variables currshortcut and currslen to support using
- the mouse with the shortcuts. FIXME - Does not support clicking
- on filenames in the browser, yet.
+ the mouse with the shortcuts. Also supports clicking on files
+ in browser.
- Changed mouse disabling code from depending on --enable-tiny
to its own flag, --disable-mouse. The --tiny option defines
this automatically, but now just mouse support can be disabled
- Implement Pico's -j and -g flags, as they are pretty easy to do.
- Make mouse support work with clicking on the shortcuts (-m). Must
make global variable pointing to current shortcut list to determine what
- keystroke to ungetch().
+ keystroke to ungetch(). [DONE].
- Implement -o (chroot of sorts)
$Id$
int col = 0, selected = 0, editline = 0, width = 0, filecols = 0;
int lineno = 0, kb;
char **filelist = (char **) NULL;
+#ifndef DISABLE_MOUSE
+#ifdef NCURSES_MOUSE_VERSION
+ MEVENT mevent;
+#endif
+#endif
currshortcut = browser_list;
currslen = BROWSER_LIST_LEN;
switch (kbinput) {
-#ifndef NANO_SMALL
+#ifndef DISABLE_MOUSE
#ifdef NCURSES_MOUSE_VERSION
case KEY_MOUSE:
- do_mouse();
+ if (getmouse(&mevent) == ERR)
+ return retval;
+
+ /* If they clicked in the edit window, they probably clicked
+ on a file */
+ if (wenclose(edit, mevent.y, mevent.x)) {
+ int selectedbackup = selected;
+
+ mevent.y -= 2;
+
+ /* If we're on line 0, don't toy with finding out what
+ page we're on */
+ if (lineno / editwinrows == 0)
+ selected = mevent.y * width + mevent.x / longest;
+ else
+ selected = (lineno / editwinrows) * editwinrows * width
+ + mevent.y * width + mevent.x / longest;
+
+ /* If we're off the screen, reset to the last item.
+ If we clicked where we did last time, select this name! */
+ if (selected >= numents - 1)
+ selected = numents - 1;
+ else if (selectedbackup == selected) {
+ ungetch('s'); /* Unget the 'select' key */
+ break;
+ }
+ } else /* Must be clicking a shortcut */
+ do_mouse();
+
break;
#endif
#endif