]> Git Repo - linux.git/commitdiff
kdb: Tweak escape handling for vi users
authorDaniel Thompson <[email protected]>
Fri, 25 Oct 2019 07:33:28 +0000 (08:33 +0100)
committerDaniel Thompson <[email protected]>
Mon, 28 Oct 2019 12:08:29 +0000 (12:08 +0000)
Currently if sequences such as "\ehelp\r" are delivered to the console then
the h gets eaten by the escape handling code. Since pressing escape
becomes something of a nervous twitch for vi users (and that escape doesn't
have much effect at a shell prompt) it is more helpful to emit the 'h' than
the '\e'.

We don't simply choose to emit the final character for all escape sequences
since that will do odd things for unsupported escape sequences (in
other words we retain the existing behaviour once we see '\e[').

Signed-off-by: Daniel Thompson <[email protected]>
Reviewed-by: Douglas Anderson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
kernel/debug/kdb/kdb_io.c

index f794c0ca4557e342ca6a4ad8bda9aecc26d74773..8bcdded5d61fcc24f71473115254ebc4820d767f 100644 (file)
@@ -163,8 +163,8 @@ char kdb_getchar(void)
 
                *pbuf++ = key;
                key = kdb_handle_escape(buf, pbuf - buf);
-               if (key < 0) /* no escape sequence; return first character */
-                       return buf[0];
+               if (key < 0) /* no escape sequence; return best character */
+                       return buf[pbuf - buf == 2 ? 1 : 0];
                if (key > 0)
                        return key;
        }
This page took 0.059017 seconds and 4 git commands to generate.