1
1

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-d3aeb78583b8
Этот коммит содержится в:
Benno Schulenberg 2014-04-16 08:24:32 +00:00
родитель 5c2b44a48a
Коммит 0d84301da3
2 изменённых файлов: 25 добавлений и 13 удалений

Просмотреть файл

@ -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>
* src/nano.c (precalc_multicolorinfo): Actually set the intended
non-blocking mode for keyboard input.

Просмотреть файл

@ -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. */
if ((j >= currslen) && (*mouse_x % i < COLS % i))
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
* the last shortcut. */
if (j >= currslen)
return 2;
/* Go through the shortcut list to determine which shortcut
* we released/clicked on. */
/* Go through the list of functions to determine which
* shortcut in the current menu we released/clicked on. */
f = allfuncs;
for (; j > 0; j--) {
if (f->next != NULL)
f = f->next;
while (f->next != NULL && ((f->menus & currmenu) == 0
while (TRUE) {
while ((f->menus & currmenu) == 0
#ifndef DISABLE_HELP
|| strlen(f->help) == 0
|| strlen(f->help) == 0
#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) {
const sc *s = first_sc_for(currmenu, f->scfunc);
if (s != NULL)
@ -1769,7 +1775,7 @@ const sc *get_shortcut(int menu, int *kbinput, bool *meta_key)
sc *s;
#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
/* Check for shortcuts. */