mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 17:31:14 -03: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:
@@ -1618,12 +1618,13 @@ fn paint_layout(&mut self, reason: &wstr, is_final_rendering: bool) {
|
|||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user