[git commit] lineedit: get terminal width before printing prompt
Denys Vlasenko
vda.linux at googlemail.com
Wed Nov 8 12:38:12 UTC 2017
commit: https://git.busybox.net/busybox/commit/?id=0a6772214002da55e982b06947320b8911a1975b
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
libbb/lineedit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 56e8140..5624a7f 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -2401,6 +2401,8 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
bb_error_msg("cur_history:%d cnt_history:%d", state->cur_history, state->cnt_history);
#endif
+ /* Get width (before printing prompt) */
+ cmdedit_termw = get_terminal_width(STDIN_FILENO);
/* Print out the command prompt, optionally ask where cursor is */
parse_and_put_prompt(prompt);
ask_terminal();
@@ -2410,8 +2412,6 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
S.SIGWINCH_handler.sa_flags = SA_RESTART;
sigaction(SIGWINCH, &S.SIGWINCH_handler, &S.SIGWINCH_handler);
- cmdedit_termw = get_terminal_width(STDIN_FILENO);
-
read_key_buffer[0] = 0;
while (1) {
/*
More information about the busybox-cvs
mailing list