aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-11-08 13:38:12 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-11-08 13:38:12 +0100
commit0a6772214002da55e982b06947320b8911a1975b (patch)
tree24f8e253c8d40e0698cc0faae5611a3c2942dc76 /libbb/lineedit.c
parentc3797d40a1c57352192c6106cc0f435e7d9c11e8 (diff)
downloadbusybox-w32-0a6772214002da55e982b06947320b8911a1975b.tar.gz
busybox-w32-0a6772214002da55e982b06947320b8911a1975b.tar.bz2
busybox-w32-0a6772214002da55e982b06947320b8911a1975b.zip
lineedit: get terminal width before printing prompt
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 56e81404e..5624a7fc3 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
2401 bb_error_msg("cur_history:%d cnt_history:%d", state->cur_history, state->cnt_history); 2401 bb_error_msg("cur_history:%d cnt_history:%d", state->cur_history, state->cnt_history);
2402#endif 2402#endif
2403 2403
2404 /* Get width (before printing prompt) */
2405 cmdedit_termw = get_terminal_width(STDIN_FILENO);
2404 /* Print out the command prompt, optionally ask where cursor is */ 2406 /* Print out the command prompt, optionally ask where cursor is */
2405 parse_and_put_prompt(prompt); 2407 parse_and_put_prompt(prompt);
2406 ask_terminal(); 2408 ask_terminal();
@@ -2410,8 +2412,6 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
2410 S.SIGWINCH_handler.sa_flags = SA_RESTART; 2412 S.SIGWINCH_handler.sa_flags = SA_RESTART;
2411 sigaction(SIGWINCH, &S.SIGWINCH_handler, &S.SIGWINCH_handler); 2413 sigaction(SIGWINCH, &S.SIGWINCH_handler, &S.SIGWINCH_handler);
2412 2414
2413 cmdedit_termw = get_terminal_width(STDIN_FILENO);
2414
2415 read_key_buffer[0] = 0; 2415 read_key_buffer[0] = 0;
2416 while (1) { 2416 while (1) {
2417 /* 2417 /*