2013-06-13 David Lawrence Ramsey <pooka109@gmail.com>
* src/global.c (first_sc_for) - try and more consistently display keystrokes, useful when the user has re-binded a bunch of them. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4579 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
2e46cc11e5
commit
bf406ffc6f
|
@ -1,3 +1,7 @@
|
||||||
|
2013-06-13 David Lawrence Ramsey <pooka109@gmail.com>
|
||||||
|
* src/global.c (first_sc_for) - try and more consistently display keystrokes,
|
||||||
|
useful when the user has re-binded a bunch of them.
|
||||||
|
|
||||||
2013-06-13 Kamil Dudka <kdudka@redhat.com>
|
2013-06-13 Kamil Dudka <kdudka@redhat.com>
|
||||||
* doc/man/nano.1 - Actually document the -P (--poslog) option.
|
* doc/man/nano.1 - Actually document the -P (--poslog) option.
|
||||||
|
|
||||||
|
|
35
src/global.c
35
src/global.c
|
@ -308,26 +308,41 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const sc *first_sc_for(int menu, void (*func)(void)) {
|
const sc *first_sc_for(int menu, void (*func)(void))
|
||||||
|
{
|
||||||
const sc *s;
|
const sc *s;
|
||||||
|
const sc *fkeysc = NULL;
|
||||||
const sc *metasc = NULL;
|
const sc *metasc = NULL;
|
||||||
|
|
||||||
for (s = sclist; s != NULL; s = s->next) {
|
for (s = sclist; s != NULL; s = s->next) {
|
||||||
if ((s->menu & menu) && s->scfunc == func) {
|
if ((s->menu & menu) && s->scfunc == func) {
|
||||||
/* try to use a meta sequence as a last resort. Otherwise
|
/* Try to use function keys and meta sequences as last
|
||||||
we will run into problems when we try and handle things like
|
* resorts. Otherwise, we will run into problems when we
|
||||||
the arrow keys, home, etc, if for some reason the user bound
|
* try and handle things like the arrow keys, Home, etc., if
|
||||||
them to a meta sequence first *shrug* */
|
* for some reason the user bound them to a function key or
|
||||||
if (s->type == META) {
|
* meta sequence first *shrug*. */
|
||||||
metasc = s;
|
if (s->type == FKEY) {
|
||||||
|
if (!fkeysc)
|
||||||
|
fkeysc = s;
|
||||||
continue;
|
continue;
|
||||||
} /* otherwise it was something else, use it */
|
} else if (s->type == META) {
|
||||||
|
if (!metasc)
|
||||||
|
metasc = s;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise, it was something else, so use it. */
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're here we may have found only meta sequences, if so use one */
|
/* If we're here, we may have found only function keys or meta
|
||||||
if (metasc)
|
* sequences. If so, use one, with the same priority as in the
|
||||||
|
* help browser: function keys come first, unless meta sequences are
|
||||||
|
* available, in which case meta sequences come first. */
|
||||||
|
if (fkeysc && !metasc)
|
||||||
|
return fkeysc;
|
||||||
|
else if (metasc)
|
||||||
return metasc;
|
return metasc;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
Loading…
Reference in New Issue