Finding properly also the zeroeth item from a
certain menu in the list of functions. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4781 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
5c2b44a48a
commit
0d84301da3
|
@ -1,3 +1,9 @@
|
||||||
|
2014-04-16 Benno Schulenberg <bensberg@justemail.net>
|
||||||
|
* src/winio.c (get_mouseinput): Properly find also the zeroeth
|
||||||
|
item from a certain menu in the list of functions. Until now
|
||||||
|
this accidentally worked, because "Get Help" was the very first
|
||||||
|
item in almost all menus. Partly fixes Savannah bug #42093.
|
||||||
|
|
||||||
2014-04-15 Benno Schulenberg <bensberg@justemail.net>
|
2014-04-15 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/nano.c (precalc_multicolorinfo): Actually set the intended
|
* src/nano.c (precalc_multicolorinfo): Actually set the intended
|
||||||
non-blocking mode for keyboard input.
|
non-blocking mode for keyboard input.
|
||||||
|
|
32
src/winio.c
32
src/winio.c
|
@ -1690,29 +1690,35 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
||||||
/* Adjust j if we released on the last two shortcuts. */
|
/* Adjust j if we released on the last two shortcuts. */
|
||||||
if ((j >= currslen) && (*mouse_x % i < COLS % i))
|
if ((j >= currslen) && (*mouse_x % i < COLS % i))
|
||||||
j -= 2;
|
j -= 2;
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, "Calculated %i as index in shortcut list, currmenu = %x.\n", j, currmenu);
|
||||||
|
#endif
|
||||||
/* Ignore releases/clicks of the first mouse button beyond
|
/* Ignore releases/clicks of the first mouse button beyond
|
||||||
* the last shortcut. */
|
* the last shortcut. */
|
||||||
if (j >= currslen)
|
if (j >= currslen)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
/* Go through the shortcut list to determine which shortcut
|
/* Go through the list of functions to determine which
|
||||||
* we released/clicked on. */
|
* shortcut in the current menu we released/clicked on. */
|
||||||
f = allfuncs;
|
f = allfuncs;
|
||||||
|
|
||||||
for (; j > 0; j--) {
|
while (TRUE) {
|
||||||
if (f->next != NULL)
|
while ((f->menus & currmenu) == 0
|
||||||
f = f->next;
|
|
||||||
|
|
||||||
while (f->next != NULL && ((f->menus & currmenu) == 0
|
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
|| strlen(f->help) == 0
|
|| strlen(f->help) == 0
|
||||||
#endif
|
#endif
|
||||||
))
|
)
|
||||||
f = f->next;
|
f = f->next;
|
||||||
|
if (j == 0)
|
||||||
|
break;
|
||||||
|
f = f->next;
|
||||||
|
j -= 1;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, "Stopped on func %ld present in menus %x\n", f->scfunc, f->menus);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* And put back the equivalent key. */
|
/* And put the corresponding key into the keyboard buffer. */
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
const sc *s = first_sc_for(currmenu, f->scfunc);
|
const sc *s = first_sc_for(currmenu, f->scfunc);
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
|
@ -1769,7 +1775,7 @@ const sc *get_shortcut(int menu, int *kbinput, bool *meta_key)
|
||||||
sc *s;
|
sc *s;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "get_shortcut(): kbinput = %d, meta_key = %s", *kbinput, *meta_key ? "TRUE" : "FALSE");
|
fprintf(stderr, "get_shortcut(): kbinput = %d, meta_key = %s -- ", *kbinput, *meta_key ? "TRUE" : "FALSE");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check for shortcuts. */
|
/* Check for shortcuts. */
|
||||||
|
|
Loading…
Reference in New Issue