diff options
author | Chris Luke <chrisy@flirble.org> | 2018-06-05 23:50:19 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2018-06-10 19:54:08 +0000 |
commit | fc379d28ab06760c8dcf0d976a5b224f1b062b97 (patch) | |
tree | 26fcf09ebdb7b3221e2574499f5ce13d81ca6444 /README.md | |
parent | 887b7ba8ad000a535ad4b7d730c6f07c0ee65165 (diff) |
cli: Fix reverse-line-wrap in terminals (VPP-1295)
- Terminals do not reverse-line-wrap when the cursor is at the left
edge and \b tries to make it go left.
- Instead, we have to track the cursor position if we need to emit \b's
and if we are at the left edge emit an ANSI sequence to relocate
the cursor. Previously we usually simply calculated the new cursor
position after a bunch of output had completed.
- Further trickiness is required since most xterm-like terminals also
defer moving the cursor to the next line when at the right edge[1], and
then if they receive a \b move the cursor back one character too many.
- This requires intricate reworking of everywhere that \b is emitted
by the CLI code during command line editing.
[1] Bash counters this issue by tracking the cursor position as output
is generated and forcing the cursor to the next line (by emitting
a space followed by \r) if it gets to this phantom cursor position);
here we effectively do that but only if the user tries to go left
when in this state.
Change-Id: I7c1d7c0e24c53111a5810cebb504ccfdac743086
Signed-off-by: Chris Luke <chrisy@flirble.org>
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions