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 <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-05-06 00:54:57 +02:00
parent c95d25731d
commit 979f05a5eb

View File

@ -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);