From 601f47a2ebcc54c995359c6f87e0eed932329e89 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 26 Apr 2016 16:45:09 +0100 Subject: lineedit: move console viewport to cursor on keypress When a normal *nix terminal has been scrolled back through its buffer, any keypress will return to the cursor position. Add code to lineedit.c to do the same for the Windows console. --- libbb/lineedit.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libbb') diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 04361b509..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: -- cgit v1.2.3-55-g6feb