diff options
author | Christian Duerr <contact@christianduerr.com> | 2023-03-25 00:07:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-24 23:07:20 +0000 |
commit | 2df8f860b960d7c96efaf4f059fe2fbbdce82bcc (patch) | |
tree | 343f21f24245b6d36dc357c206d4f754359c924c /alacritty/src/display | |
parent | ef8cc5d63f34b09e46d8c733cd5a472d480f7cf1 (diff) | |
download | r-alacritty-2df8f860b960d7c96efaf4f059fe2fbbdce82bcc.tar.gz r-alacritty-2df8f860b960d7c96efaf4f059fe2fbbdce82bcc.tar.bz2 r-alacritty-2df8f860b960d7c96efaf4f059fe2fbbdce82bcc.zip |
Fix selection rotation on the last line
This fixes an issue with terminal resizes when the selection is on the
last line. Alacritty would fail to rotate lines and keep the selection
in the same line index whenever the terminal line count was grown or
shrunk.
This issue occurred due to the range passed to the selection's rotate
function still being based on the old terminal size, which caused the
initial or target state of the rotation to be outside of the terminal
bounds.
Closes #6698.
Diffstat (limited to 'alacritty/src/display')
-rw-r--r-- | alacritty/src/display/content.rs | 2 | ||||
-rw-r--r-- | alacritty/src/display/mod.rs | 18 |
2 files changed, 8 insertions, 12 deletions
diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs index c062ba9b..ca49c01a 100644 --- a/alacritty/src/display/content.rs +++ b/alacritty/src/display/content.rs @@ -199,7 +199,7 @@ pub struct RenderableCellExtra { } impl RenderableCell { - fn new<'a>(content: &mut RenderableContent<'a>, cell: Indexed<&Cell>) -> Self { + fn new(content: &mut RenderableContent<'_>, cell: Indexed<&Cell>) -> Self { // Lookup RGB values. let mut fg = Self::compute_fg_rgb(content, cell.fg, cell.flags); let mut bg = Self::compute_bg_rgb(content, cell.bg); diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs index f1757ae6..4d9c1540 100644 --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -588,11 +588,10 @@ impl Display { }); } + // XXX: this function must not call to any `OpenGL` related tasks. Renderer updates are + // performed in [`Self::process_renderer_update`] right befor drawing. + // /// Process update events. - /// - /// XXX: this function must not call to any `OpenGL` related tasks. Only logical update - /// of the state is being performed here. Rendering update takes part right before the - /// actual rendering. pub fn handle_update<T>( &mut self, terminal: &mut Term<T>, @@ -666,14 +665,11 @@ impl Display { self.size_info = new_size; } + // NOTE: Renderer updates are split off, since platforms like Wayland require resize and other + // OpenGL operations to be performed right before rendering. Otherwise they could lock the + // back buffer and render with the previous state. This also solves flickering during resizes. + // /// Update the state of the renderer. - /// - /// NOTE: The update to the renderer is split from the display update on purpose, since - /// on some platforms, like Wayland, resize and other OpenGL operations must be performed - /// right before rendering, otherwise they could lock the back buffer resulting in - /// rendering with the buffer of old size. - /// - /// This also resolves any flickering, since the resize is now synced with frame callbacks. pub fn process_renderer_update(&mut self) { let renderer_update = match self.pending_renderer_update.take() { Some(renderer_update) => renderer_update, |