mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 00:01:15 -03: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:
@@ -1380,7 +1380,7 @@ fn paint_layout(&mut self, reason: &wstr) {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user