mirror of https://github.com/MidnightCommander/mc
Minor optimization of listbox_key() function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
081723c4e7
commit
361f95a976
21
src/widget.c
21
src/widget.c
|
@ -2284,6 +2284,9 @@ listbox_key (WListbox *l, int key)
|
|||
|
||||
cb_ret_t j = MSG_NOT_HANDLED;
|
||||
|
||||
if (l->list == NULL)
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
/* focus on listbox item N by '0'..'9' keys */
|
||||
if (key >= '0' && key <= '9') {
|
||||
int oldpos = l->pos;
|
||||
|
@ -2296,9 +2299,6 @@ listbox_key (WListbox *l, int key)
|
|||
return MSG_HANDLED;
|
||||
}
|
||||
|
||||
if (l->list == NULL)
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
switch (key){
|
||||
case KEY_HOME:
|
||||
case KEY_A1:
|
||||
|
@ -2328,7 +2328,7 @@ listbox_key (WListbox *l, int key)
|
|||
listbox_fwd (l);
|
||||
j = MSG_HANDLED;
|
||||
}
|
||||
return j;
|
||||
break;
|
||||
|
||||
case KEY_PPAGE:
|
||||
case ALT('v'):
|
||||
|
@ -2336,7 +2336,7 @@ listbox_key (WListbox *l, int key)
|
|||
listbox_back (l);
|
||||
j = MSG_HANDLED;
|
||||
}
|
||||
return j;
|
||||
break;
|
||||
|
||||
case KEY_DC:
|
||||
case 'd':
|
||||
|
@ -2352,17 +2352,20 @@ listbox_key (WListbox *l, int key)
|
|||
case (KEY_M_SHIFT | KEY_DC):
|
||||
case 'D':
|
||||
if (l->deletable && confirm_history_cleanup
|
||||
&& (query_dialog (Q_("DialogTitle|Clean history"),
|
||||
/* TRANSLATORS: no need to translate 'DialogTitle', it's just a context prefix */
|
||||
&& (query_dialog (Q_("DialogTitle|History cleanup"),
|
||||
_("Do you want clean this history?"),
|
||||
D_ERROR, 2, _("&Yes"), _("&No")) == 0))
|
||||
D_ERROR, 2, _("&Yes"), _("&No")) == 0)) {
|
||||
listbox_remove_list (l);
|
||||
return MSG_HANDLED;
|
||||
j = MSG_HANDLED;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return MSG_NOT_HANDLED;
|
||||
return j;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
Loading…
Reference in New Issue