diff options
author | Avi Halachmi <avihpit@yahoo.com> | 2017-10-12 16:38:35 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-10-12 18:26:13 +0200 |
commit | 0fd5dbba8f34e006aa0e999002d31e79daf2fdf3 (patch) | |
tree | c773d6a6de361d3c18cffb18f3a5fb8816ac38d4 /console-tools/chvt.c | |
parent | 1121b4e568b340cfe2a9b7fc41fb48f4d684ad47 (diff) | |
download | busybox-0fd5dbba8f34e006aa0e999002d31e79daf2fdf3.tar.gz |
lineedit: improve multiline PS1 - redraw using last PS1 line. Closes 10381
This patch only affects prompts with newlines.
We redraw the prompt [+ input] occasionally, e.g. during tab completion,
history browsing or search, etc, and we expect it to align with prior
redraws, such that the visible effect is that only the input changes.
With multi-line PS1, redraw always printed the prompt some lines below
the old one, which resulted in terminal scroll during every redraw.
Now we only redraw the last PS1 line, so vertical alignment is easier to
manage (we already calculated it using only the last line, but re-drew
all lines - that was the culprit), which fixes those extra scrolls.
Notes:
- We now use the full prompt for the initial draw, after clear-screen (^L),
and after tab-completion choices are displayed. Everything else now
redraws using the last/sole prompt line.
- During terminal resize we now only redraw the last[/sole] prompt line,
which is arguably better because it's hard to do right (and we never did).
- Good side effect for reverse-i-search: its prompt now replaces only the
last line of the original prompt - like other shells do.
function old new delta
put_prompt_custom - 66 +66
draw_custom - 66 +66
parse_and_put_prompt 766 806 +40
read_line_input 3867 3884 +17
input_tab 1069 1076 +7
cmdedit_setwidth 61 63 +2
redraw 59 47 -12
put_prompt 46 - -46
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 4/1 up/down: 198/-58) Total: 140 bytes
Signed-off-by: Avi Halachmi <avihpit@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'console-tools/chvt.c')
0 files changed, 0 insertions, 0 deletions