X11: Match new extcmd immediately if no match was found

When entering an extended command, allow the user just type
and match a new command immediately, if no match was found,
instead of needing to wait the 2.5 seconds.
This commit is contained in:
Pasi Kallinen
2016-01-16 19:05:30 +02:00
parent eee6a87b85
commit 06aedee513
+13 -1
View File
@@ -716,6 +716,7 @@ Cardinal *num_params;
{ {
char ch; char ch;
int i; int i;
int pass;
XKeyEvent *xkey = (XKeyEvent *) event; XKeyEvent *xkey = (XKeyEvent *) event;
nhUse(w); nhUse(w);
@@ -768,6 +769,16 @@ Cardinal *num_params;
if (ec_nchars >= EC_NCHARS) if (ec_nchars >= EC_NCHARS)
ec_nchars = EC_NCHARS - 1; /* don't overflow */ ec_nchars = EC_NCHARS - 1; /* don't overflow */
for (pass = 0; pass < 2; pass++) {
if (pass == 1) {
/* first pass finished, but no matching command was found */
/* start a new one with the last char entered */
if (extended_command_selected >= 0)
swap_fg_bg(extended_commands[extended_command_selected]);
extended_command_selected = -1; /* dismiss */
ec_chars[0] = ec_chars[ec_nchars-1];
ec_nchars = 1;
}
for (i = 0; extcmdlist[i].ef_txt; i++) { for (i = 0; extcmdlist[i].ef_txt; i++) {
if (extcmdlist[i].ef_txt[0] == '?') if (extcmdlist[i].ef_txt[0] == '?')
continue; continue;
@@ -781,7 +792,8 @@ Cardinal *num_params;
extended_command_selected = i; extended_command_selected = i;
swap_fg_bg(extended_commands[extended_command_selected]); swap_fg_bg(extended_commands[extended_command_selected]);
} }
break; return;
}
} }
} }
} }