From 5ade8c00479520031b6a507e4db088fca7d82893 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 21 Dec 2022 15:05:04 +0000 Subject: [PATCH] ldisc: fix unwanted double-action of ^U. In ldisc's line editing mode, pressing ^U is supposed to erase the current unsent line rather than inserting a literal ^U into the buffer. In fact, when using a non-Telnet backend, it erases the line *and* inserts ^U into the buffer! This happens because it shares a case handler with three other disruptive control characters (^C, ^\, ^Z), which all also clear the line-editing buffer before doing their various actions. But in non-Telnet mode, their actions become literal insertion of themselves, so the combined effect is to erase the line and them self-insert. I'm not 100% convinced that was what I actually meant to do with those characters. But it _certainly_ wasn't what I meant to do with ^U, so that one at least I should fix right now! --- ldisc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ldisc.c b/ldisc.c index caff52d0..27f41a6f 100644 --- a/ldisc.c +++ b/ldisc.c @@ -442,6 +442,8 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, bool interactive) bsb(ldisc, plen(ldisc, ldisc->buf[ldisc->buflen - 1])); ldisc->buflen--; } + if (c == CTRL('U')) + break; /* ^U *just* erases a line */ ldisc_to_backend_special(ldisc, SS_EL, 0); /* * We don't send IP, SUSP or ABORT if the user has