From 979f05a5eb8aa6c9e6ce4663bb78c970bfeebb46 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 6 May 2019 00:54:57 +0200 Subject: [PATCH] Follow-up to a4b67d2: Ctrl-L redisplay line when not on empty line Like Ctrl-D, when on an empty line we clear the screen, when editing a garbled line we refresh the line. Signed-off-by: Joachim Nilsson --- src/editline.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/editline.c b/src/editline.c index 70f3bbd..1d0cfa6 100644 --- a/src/editline.c +++ b/src/editline.c @@ -538,8 +538,11 @@ int rl_insert_text(const char *text) static el_status_t redisplay(void) { - /* XXX: Use "\r\e[K" to get really neat effect on ANSI capable terminals. */ - tty_puts(CLEAR); + if (rl_point == 0) + tty_puts(CLEAR); + else + tty_puts("\r\e[K"); + tty_puts(rl_prompt); tty_string(rl_line_buffer);