From: Daniel Thompson <daniel.thompson@linaro.org>
To: Jason Wessel <jason.wessel@windriver.com>,
Douglas Anderson <dianders@chromium.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>,
kgdb-bugreport@lists.sourceforge.net,
linux-kernel@vger.kernel.org, patches@linaro.org
Subject: [PATCH v3 5/5] kdb: Tweak escape handling for vi users
Date: Mon, 14 Oct 2019 16:46:26 +0100 [thread overview]
Message-ID: <20191014154626.351-6-daniel.thompson@linaro.org> (raw)
In-Reply-To: <20191014154626.351-1-daniel.thompson@linaro.org>
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>
---
kernel/debug/kdb/kdb_io.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c
index f9839566c7d6..5e71bb2596ed 100644
--- a/kernel/debug/kdb/kdb_io.c
+++ b/kernel/debug/kdb/kdb_io.c
@@ -161,8 +161,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;
}
--
2.21.0
next prev parent reply other threads:[~2019-10-14 15:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 15:46 [PATCH v3 0/5] kdb: Cleanup code to read user input and handle escape sequences Daniel Thompson
2019-10-14 15:46 ` [PATCH v3 1/5] kdb: Tidy up code to " Daniel Thompson
2019-10-14 15:46 ` [PATCH v3 2/5] kdb: Simplify code to fetch characters from console Daniel Thompson
2019-10-14 15:46 ` [PATCH v3 3/5] kdb: Remove special case logic from kdb_read() Daniel Thompson
2019-10-17 4:10 ` Doug Anderson
2019-10-17 9:14 ` Daniel Thompson
2019-10-14 15:46 ` [PATCH v3 4/5] kdb: Improve handling of characters from different input sources Daniel Thompson
2019-10-17 4:11 ` Doug Anderson
2019-10-14 15:46 ` Daniel Thompson [this message]
2019-10-17 4:12 ` [PATCH v3 5/5] kdb: Tweak escape handling for vi users Doug Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191014154626.351-6-daniel.thompson@linaro.org \
--to=daniel.thompson@linaro.org \
--cc=dianders@chromium.org \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®