← Commit list

0a6772214

Denys Vlasenko
Denys Vlasenko
2017-11-08
SUCCESS Duration: 143s

Subject

lineedit: get terminal width before printing prompt

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/lineedit.c+2 -2
@@ -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) {
/*