aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2018-07-29 11:28:31 +0100
committerDaniel Thompson <daniel.thompson@linaro.org>2019-10-07 16:35:57 +0100
commitba6616f39b4ada15ff4c664131fb70759bef3c62 (patch)
treebb2aa102e12c2b26bdd6916e6a790bf91b668ea5
parent674b6a25b89f283cd40b637e96a0beb67a14dc01 (diff)
kdb: Tweak escape handling for vi userskgdb/kdb_read_cleanup
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 <daniel.thompson@linaro.org>
-rw-r--r--kernel/debug/kdb/kdb_io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c
index a1d99f4fcfd7..841ed5fbad4f 100644
--- a/kernel/debug/kdb/kdb_io.c
+++ b/kernel/debug/kdb/kdb_io.c
@@ -154,8 +154,8 @@ static int kdb_getchar(void)
*pbuf++ = key;
key = kdb_read_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 ? 0 : 1];
if (key > 0)
return key;
}