cmd_from_func prefers printable key over ctrl combination
If command is bound to multiple keys (like #kick), cmd_from_func prefers to return the key in the printable range over a ctrl-key combo.
This commit is contained in:
@@ -3598,10 +3598,12 @@ cmd_from_dir(int dir, int mode)
|
|||||||
return cmd_from_func(move_funcs[dir][mode]);
|
return cmd_from_func(move_funcs[dir][mode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* return the key bound to extended command */
|
||||||
char
|
char
|
||||||
cmd_from_func(int (*fn)(void))
|
cmd_from_func(int (*fn)(void))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
char ret = '\0';
|
||||||
|
|
||||||
/* skip NUL; allowing it would wreak havoc */
|
/* skip NUL; allowing it would wreak havoc */
|
||||||
for (i = 1; i < 256; ++i) {
|
for (i = 1; i < 256; ++i) {
|
||||||
@@ -3615,12 +3617,17 @@ cmd_from_func(int (*fn)(void))
|
|||||||
&& !gc.Cmd.num_pad)
|
&& !gc.Cmd.num_pad)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (gc.Cmd.commands[i] && gc.Cmd.commands[i]->ef_funct == fn)
|
if (gc.Cmd.commands[i] && gc.Cmd.commands[i]->ef_funct == fn) {
|
||||||
return (char) i;
|
if (i >= ' ' && i <= '~')
|
||||||
|
return (char) i;
|
||||||
|
else {
|
||||||
|
ret = (char) i;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (gc.Cmd.commands[' '] && gc.Cmd.commands[' ']->ef_funct == fn)
|
if (gc.Cmd.commands[' '] && gc.Cmd.commands[' ']->ef_funct == fn)
|
||||||
return ' ';
|
return ' ';
|
||||||
return '\0';
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return visual interpretation of the key bound to extended command,
|
/* return visual interpretation of the key bound to extended command,
|
||||||
|
|||||||
Reference in New Issue
Block a user