commit 04f4767aa45083745e8ffcd6229a7b6b2ecf58a0
parent 8718701de63a6c466b73ab5253f0aad7cd9017d5
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 3 Jul 2020 15:51:03 +0200
improve the uiprompt a bit
- add a 1 cell margin (no reverse mode) between the prompt and input cursor.
- set term attribute right before getline() (should make no difference though).
Diffstat:
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -850,20 +850,19 @@ uiprompt(int x, int y, char *fmt, ...)
buf[sizeof(buf) - 1] = '\0';
va_end(ap);
- tcgetattr(ttyfd, &tset);
- tset.c_lflag |= (ECHO|ICANON);
- tcsetattr(ttyfd, TCSANOW, &tset);
-
cursormove(x, y);
attrmode(ATTR_REVERSE_ON);
fputs(buf, stdout);
attrmode(ATTR_REVERSE_OFF);
-
cleareol();
cursormode(1);
- cursormove(x + colw(buf), y);
+ cursormove(x + colw(buf) + 1, y);
fflush(stdout);
+ tcgetattr(ttyfd, &tset);
+ tset.c_lflag |= (ECHO|ICANON);
+ tcsetattr(ttyfd, TCSANOW, &tset);
+
n = 0;
r = getline(&input, &n, stdin);
@@ -1577,7 +1576,7 @@ nextpage:
tmp = ch == '?' ? "backward" : "forward";
free(search);
search = uiprompt(statusbar.x, statusbar.y,
- "Search (%s): ", tmp);
+ "Search (%s):", tmp);
alldirty();
draw();
}