aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/display/mod.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2023-11-03 05:50:45 +0100
committerGitHub <noreply@github.com>2023-11-03 04:50:45 +0000
commit46f8e39880592edb47f9b54f3f34ebbcfaa01c61 (patch)
treee87d4a275a53f366afdb8af2a92e44f7c7c54e57 /alacritty/src/display/mod.rs
parent609499640f4c45ac6ff1f7c7e1b100dea3e88858 (diff)
downloadr-alacritty-46f8e39880592edb47f9b54f3f34ebbcfaa01c61.tar.gz
r-alacritty-46f8e39880592edb47f9b54f3f34ebbcfaa01c61.tar.bz2
r-alacritty-46f8e39880592edb47f9b54f3f34ebbcfaa01c61.zip
Fix crash when leaving search after resize
This fixes a crash which could occur when leaving search with a visible match after shrinking the terminal height to be lower than the original line the focused match was in. Closes #7054.
Diffstat (limited to 'alacritty/src/display/mod.rs')
-rw-r--r--alacritty/src/display/mod.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
index 7380e8c3..dfe2809f 100644
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -598,7 +598,7 @@ impl Display {
terminal: &mut Term<T>,
pty_resize_handle: &mut dyn OnResize,
message_buffer: &MessageBuffer,
- search_active: bool,
+ search_state: &mut SearchState,
config: &UiConfig,
) where
T: EventListener,
@@ -643,6 +643,7 @@ impl Display {
);
// Update number of column/lines in the viewport.
+ let search_active = search_state.history_index.is_some();
let message_bar_lines = message_buffer.message().map_or(0, |m| m.text(&new_size).len());
let search_lines = usize::from(search_active);
new_size.reserve_lines(message_bar_lines + search_lines);
@@ -658,10 +659,14 @@ impl Display {
// Resize terminal.
terminal.resize(new_size);
- // Queue renderer update if terminal dimensions/padding changed.
+ // Check if dimensions have changed.
if new_size != self.size_info {
+ // Queue renderer update.
let renderer_update = self.pending_renderer_update.get_or_insert(Default::default());
renderer_update.resize = true;
+
+ // Clear focused search match.
+ search_state.clear_focused_match();
}
self.size_info = new_size;
}