From fd476d8629d489245e18ec278d3c846ab1359eec Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 26 Apr 2016 11:12:42 +0100 Subject: libbb/lineedit: scroll to cursor position on any keypress Also improve erase_till_end_of_screen. Based on suggestions from GitHub user avih. --- libbb/lineedit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libbb') diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 37c106bd8..e7b9ddfa1 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -2440,6 +2440,11 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman fflush_all(); ic = ic_raw = lineedit_read_key(read_key_buffer, timeout); +#if ENABLE_PLATFORM_MINGW32 + /* scroll to cursor position on any keypress */ + if (isatty(fileno(stdin)) && isatty(fileno(stdout))) + move_cursor_row(0); +#endif #if ENABLE_FEATURE_REVERSE_SEARCH again: @@ -2510,9 +2515,6 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman case CTRL('L'): vi_case(CTRL('L')|VI_CMDMODE_BIT:) /* Control-l -- clear screen */ -#if ENABLE_PLATFORM_MINGW32 - printf(ESC"[0A"); /* move to current cursor postion */ -#endif printf(ESC"[H"); /* cursor to top,left */ redraw(0, command_len - cursor); break; -- cgit v1.2.3-55-g6feb