Added file clicking ability in file browser
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@640 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
88520c93be
commit
051fc6e05a
|
@ -1,8 +1,8 @@
|
||||||
Cvs code -
|
Cvs code -
|
||||||
- General
|
- General
|
||||||
- New global variables currshortcut and currslen to support using
|
- New global variables currshortcut and currslen to support using
|
||||||
the mouse with the shortcuts. FIXME - Does not support clicking
|
the mouse with the shortcuts. Also supports clicking on files
|
||||||
on filenames in the browser, yet.
|
in browser.
|
||||||
- Changed mouse disabling code from depending on --enable-tiny
|
- Changed mouse disabling code from depending on --enable-tiny
|
||||||
to its own flag, --disable-mouse. The --tiny option defines
|
to its own flag, --disable-mouse. The --tiny option defines
|
||||||
this automatically, but now just mouse support can be disabled
|
this automatically, but now just mouse support can be disabled
|
||||||
|
|
2
TODO
2
TODO
|
@ -28,7 +28,7 @@ For Next Version:
|
||||||
- Implement Pico's -j and -g flags, as they are pretty easy to do.
|
- 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 mouse support work with clicking on the shortcuts (-m). Must
|
||||||
make global variable pointing to current shortcut list to determine what
|
make global variable pointing to current shortcut list to determine what
|
||||||
keystroke to ungetch().
|
keystroke to ungetch(). [DONE].
|
||||||
- Implement -o (chroot of sorts)
|
- Implement -o (chroot of sorts)
|
||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
|
|
35
files.c
35
files.c
|
@ -1139,6 +1139,11 @@ char *do_browser(char *inpath)
|
||||||
int col = 0, selected = 0, editline = 0, width = 0, filecols = 0;
|
int col = 0, selected = 0, editline = 0, width = 0, filecols = 0;
|
||||||
int lineno = 0, kb;
|
int lineno = 0, kb;
|
||||||
char **filelist = (char **) NULL;
|
char **filelist = (char **) NULL;
|
||||||
|
#ifndef DISABLE_MOUSE
|
||||||
|
#ifdef NCURSES_MOUSE_VERSION
|
||||||
|
MEVENT mevent;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
currshortcut = browser_list;
|
currshortcut = browser_list;
|
||||||
currslen = BROWSER_LIST_LEN;
|
currslen = BROWSER_LIST_LEN;
|
||||||
|
@ -1186,10 +1191,38 @@ char *do_browser(char *inpath)
|
||||||
|
|
||||||
switch (kbinput) {
|
switch (kbinput) {
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef DISABLE_MOUSE
|
||||||
#ifdef NCURSES_MOUSE_VERSION
|
#ifdef NCURSES_MOUSE_VERSION
|
||||||
case KEY_MOUSE:
|
case KEY_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();
|
do_mouse();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue