mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Fix regression when selection start is deleted
Ranges with start > end are invalid; we crash with "slice index starts at 10 but ends at 0".
This commit is contained in:
parent
b535213ac0
commit
a29cc8f169
2 changed files with 11 additions and 1 deletions
|
@ -1380,7 +1380,7 @@ impl ReaderData {
|
|||
let selection_color =
|
||||
HighlightSpec::with_fg_bg(HighlightRole::selection, HighlightRole::selection);
|
||||
let end = std::cmp::min(selection.stop, colors.len());
|
||||
for color in &mut colors[selection.start..end] {
|
||||
for color in &mut colors[selection.start.min(end)..end] {
|
||||
*color = selection_color;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,3 +19,13 @@ isolated-tmux capture-pane -p
|
|||
# CHECK: prompt 0> begin
|
||||
# CHECK: echo 123
|
||||
# CHECK: end
|
||||
|
||||
# regression test
|
||||
isolated-tmux send-keys C-c # not sure why we need to wait after this
|
||||
tmux-sleep
|
||||
isolated-tmux send-keys 'bind S begin-selection' Enter C-l
|
||||
tmux-sleep
|
||||
isolated-tmux send-keys 'echo one two threeS' C-u C-y
|
||||
tmux-sleep
|
||||
isolated-tmux capture-pane -p
|
||||
# CHECK: prompt 1> echo one two three
|
||||
|
|
Loading…
Reference in a new issue