mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-25 14:51:15 -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.
|
||||
if !self.conf.in_silent_mode && data.history_search_range.is_some() {
|
||||
let mut end = data.history_search_range.unwrap().end();
|
||||
if colors.len() < end {
|
||||
end = colors.len();
|
||||
let mut range = data.history_search_range.unwrap().as_usize();
|
||||
if range.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.background = HighlightRole::search_match;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user