mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-16 07:33:17 +08:00
Fix regression causing crash in token history search
I'm not yet sure how to reproduce4dfcd4cb4e
(reader: Check bounds for color, 2022-08-26). Commit55fd43d86c
(Port reader, 2023-12-22) accidentally changed historical behavior, fix that. Fixes #11096
This commit is contained in:
parent
9882849fda
commit
7dc046b959
|
@ -1492,12 +1492,13 @@ impl<'a> Reader<'a> {
|
||||||
|
|
||||||
// Highlight any history search.
|
// Highlight any history search.
|
||||||
if !self.conf.in_silent_mode && data.history_search_range.is_some() {
|
if !self.conf.in_silent_mode && data.history_search_range.is_some() {
|
||||||
let mut end = data.history_search_range.unwrap().end();
|
let mut range = data.history_search_range.unwrap().as_usize();
|
||||||
if colors.len() < end {
|
if range.end > colors.len() {
|
||||||
end = colors.len();
|
range.start = range.start.min(colors.len());
|
||||||
|
range.end = colors.len();
|
||||||
}
|
}
|
||||||
|
|
||||||
for color in &mut colors[data.history_search_range.unwrap().start()..end] {
|
for color in &mut colors[range] {
|
||||||
color.foreground = HighlightRole::search_match;
|
color.foreground = HighlightRole::search_match;
|
||||||
color.background = HighlightRole::search_match;
|
color.background = HighlightRole::search_match;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user