diff options
author | Ron Yorston <rmy@pobox.com> | 2016-04-26 11:12:42 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2016-04-26 11:12:42 +0100 |
commit | fd476d8629d489245e18ec278d3c846ab1359eec (patch) | |
tree | da17890f38659af2d2fb6b00872fe7b81a2472b9 /libbb | |
parent | 9a7f488564610817a7b9d9d44d7db154e444eb7d (diff) | |
download | busybox-w32-fd476d8629d489245e18ec278d3c846ab1359eec.tar.gz busybox-w32-fd476d8629d489245e18ec278d3c846ab1359eec.tar.bz2 busybox-w32-fd476d8629d489245e18ec278d3c846ab1359eec.zip |
libbb/lineedit: scroll to cursor position on any keypress
Also improve erase_till_end_of_screen. Based on suggestions from
GitHub user avih.
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/lineedit.c | 8 |
1 files changed, 5 insertions, 3 deletions
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 | |||
2440 | 2440 | ||
2441 | fflush_all(); | 2441 | fflush_all(); |
2442 | ic = ic_raw = lineedit_read_key(read_key_buffer, timeout); | 2442 | ic = ic_raw = lineedit_read_key(read_key_buffer, timeout); |
2443 | #if ENABLE_PLATFORM_MINGW32 | ||
2444 | /* scroll to cursor position on any keypress */ | ||
2445 | if (isatty(fileno(stdin)) && isatty(fileno(stdout))) | ||
2446 | move_cursor_row(0); | ||
2447 | #endif | ||
2443 | 2448 | ||
2444 | #if ENABLE_FEATURE_REVERSE_SEARCH | 2449 | #if ENABLE_FEATURE_REVERSE_SEARCH |
2445 | again: | 2450 | again: |
@@ -2510,9 +2515,6 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman | |||
2510 | case CTRL('L'): | 2515 | case CTRL('L'): |
2511 | vi_case(CTRL('L')|VI_CMDMODE_BIT:) | 2516 | vi_case(CTRL('L')|VI_CMDMODE_BIT:) |
2512 | /* Control-l -- clear screen */ | 2517 | /* Control-l -- clear screen */ |
2513 | #if ENABLE_PLATFORM_MINGW32 | ||
2514 | printf(ESC"[0A"); /* move to current cursor postion */ | ||
2515 | #endif | ||
2516 | printf(ESC"[H"); /* cursor to top,left */ | 2518 | printf(ESC"[H"); /* cursor to top,left */ |
2517 | redraw(0, command_len - cursor); | 2519 | redraw(0, command_len - cursor); |
2518 | break; | 2520 | break; |