From: NeilBrown Date: Sat, 19 Aug 2023 22:34:13 +0000 (+1000) Subject: display-ncurses: ignore focus changes better. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=d13f9b3dbfea1dcbde071f5a06b1ae872a9f0992;p=edlib.git display-ncurses: ignore focus changes better. If we got a focus change message, 'buf' would be uninitialised and used. So initialise it - and don't use it. Signed-off-by: NeilBrown --- diff --git a/display-ncurses.c b/display-ncurses.c index 0b1eda07..1e854f42 100644 --- a/display-ncurses.c +++ b/display-ncurses.c @@ -1559,7 +1559,8 @@ static void send_key(int keytype, wint_t c, int alt, struct pane *p safe) LOG("Unknown ncurses key 0o%o", c); sprintf(buf, "%sNcurs-%o", a, c); } else if (strstarts(n, ":Focus-")) - /* Ignore focus changes for now */; + /* Ignore focus changes for now */ + buf[0] = 0; else strcat(strcpy(buf, a), n); } else { @@ -1574,8 +1575,10 @@ static void send_key(int keytype, wint_t c, int alt, struct pane *p safe) } dd->last_event = time(NULL); - record_key(p, buf); - call("Keystroke", p, 0, NULL, buf); + if (buf[0]) { + record_key(p, buf); + call("Keystroke", p, 0, NULL, buf); + } } static void do_send_mouse(struct pane *p safe, int x, int y, char *cmd safe,