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:
+24
-12
@@ -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,20 +769,31 @@ 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 (i = 0; extcmdlist[i].ef_txt; i++) {
|
for (pass = 0; pass < 2; pass++) {
|
||||||
if (extcmdlist[i].ef_txt[0] == '?')
|
if (pass == 1) {
|
||||||
continue;
|
/* first pass finished, but no matching command was found */
|
||||||
|
/* start a new one with the last char entered */
|
||||||
if (!strncmp(ec_chars, extcmdlist[i].ef_txt, ec_nchars)) {
|
if (extended_command_selected >= 0)
|
||||||
if (extended_command_selected != i) {
|
|
||||||
/* I should use set() and unset() actions, but how do */
|
|
||||||
/* I send the an action to the widget? */
|
|
||||||
if (extended_command_selected >= 0)
|
|
||||||
swap_fg_bg(extended_commands[extended_command_selected]);
|
|
||||||
extended_command_selected = i;
|
|
||||||
swap_fg_bg(extended_commands[extended_command_selected]);
|
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++) {
|
||||||
|
if (extcmdlist[i].ef_txt[0] == '?')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!strncmp(ec_chars, extcmdlist[i].ef_txt, ec_nchars)) {
|
||||||
|
if (extended_command_selected != i) {
|
||||||
|
/* I should use set() and unset() actions, but how do */
|
||||||
|
/* I send the an action to the widget? */
|
||||||
|
if (extended_command_selected >= 0)
|
||||||
|
swap_fg_bg(extended_commands[extended_command_selected]);
|
||||||
|
extended_command_selected = i;
|
||||||
|
swap_fg_bg(extended_commands[extended_command_selected]);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user