mirror of https://github.com/MidnightCommander/mc
(learn_key): return NULL if buffer is empty.
(learn_button): simplify tests: seq is never empty here. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
0e09fc3088
commit
31008bcc8e
|
@ -2193,7 +2193,7 @@ learn_key (void)
|
|||
tty_keypad (TRUE);
|
||||
tty_nodelay (FALSE);
|
||||
*p = '\0';
|
||||
return g_strdup (buffer);
|
||||
return (buffer[0] != '\0' ? g_strdup (buffer) : NULL);
|
||||
#undef LEARN_TIMEOUT
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ learn_button (WButton * button, int action)
|
|||
*/
|
||||
gboolean seq_ok = FALSE;
|
||||
|
||||
if (*seq != '\0' && strcmp (seq, "\\e") != 0 && strcmp (seq, "\\e\\e") != 0
|
||||
if (strcmp (seq, "\\e") != 0 && strcmp (seq, "\\e\\e") != 0
|
||||
&& strcmp (seq, "^m") != 0 && strcmp (seq, "^i") != 0
|
||||
&& (seq[1] != '\0' || *seq < ' ' || *seq > '~'))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue