mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-19 09:51:16 -03:00
Handle backspaces for visible width
This makes it so we treat backspaces as width -1, but never go below a 0 total width when talking about *lines*, like in screen or string length --visible. Fixes #8277.
This commit is contained in:
@@ -112,6 +112,23 @@ string length --visible a(set_color blue)b\ncde
|
||||
# CHECK: 2
|
||||
# CHECK: 3
|
||||
|
||||
# Backslashes and visible length:
|
||||
# It can't move us before the start of the line.
|
||||
string length --visible \b
|
||||
# CHECK: 0
|
||||
|
||||
# It can't move us before the start of the line.
|
||||
string length --visible \bf
|
||||
# CHECK: 1
|
||||
|
||||
# But it does erase chars before.
|
||||
string length --visible \bf\b
|
||||
# CHECK: 0
|
||||
|
||||
# Never move past 0.
|
||||
string length --visible \bf\b\b\b\b\b
|
||||
# CHECK: 0
|
||||
|
||||
string sub --length 2 abcde
|
||||
# CHECK: ab
|
||||
|
||||
|
||||
Reference in New Issue
Block a user