From 813a96b517ae96716fb018ff93ab2d6a4bbcda95 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Mon, 14 Mar 2022 14:07:20 +0100 Subject: sfeed_curses: use ttywrite() for writing to the tty consistently This should also suppress a compiler warning of an unchecked write() return value. --- sfeed_curses.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sfeed_curses.c b/sfeed_curses.c index 1c6bc24..d0ca7dd 100644 --- a/sfeed_curses.c +++ b/sfeed_curses.c @@ -986,7 +986,7 @@ lineeditor(void) int ch; for (;;) { - if (nchars + 1 >= cap) { + if (nchars + 2 >= cap) { cap = cap ? cap * 2 : 32; input = erealloc(input, cap); } @@ -999,11 +999,11 @@ lineeditor(void) if (!nchars) continue; input[--nchars] = '\0'; - write(1, "\b \b", 3); /* back, blank, back */ - continue; + ttywrite("\b \b"); /* back, blank, back */ } else if (ch >= ' ') { input[nchars] = ch; - write(1, &input[nchars], 1); + input[nchars + 1] = '\0'; + ttywrite(&input[nchars]); nchars++; } else if (ch < 0) { switch (sigstate) { -- cgit v1.2.3