aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/event.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-11-14 23:17:59 +0400
committerGitHub <noreply@github.com>2023-11-14 23:17:59 +0400
commitd83d5af2b571e5dc2c5c622277096a91c04ca7eb (patch)
tree9b8ce3c569e664c91399a52d37471b07ce0d0207 /alacritty/src/event.rs
parent13834d4de80b2a163f7d1838d34f67f088d2c218 (diff)
downloadr-alacritty-d83d5af2b571e5dc2c5c622277096a91c04ca7eb.tar.gz
r-alacritty-d83d5af2b571e5dc2c5c622277096a91c04ca7eb.tar.bz2
r-alacritty-d83d5af2b571e5dc2c5c622277096a91c04ca7eb.zip
Fix Vi cursor not being dirty when scrolling
Diffstat (limited to 'alacritty/src/event.rs')
-rw-r--r--alacritty/src/event.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index f7fd044c..e6f77e8c 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -252,6 +252,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
fn scroll(&mut self, scroll: Scroll) {
let old_offset = self.terminal.grid().display_offset() as i32;
+ let old_vi_cursor = self.terminal.vi_mode_cursor;
self.terminal.scroll_display(scroll);
let lines_changed = old_offset - self.terminal.grid().display_offset() as i32;
@@ -261,10 +262,10 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
self.search_state.display_offset_delta += lines_changed;
}
+ let vi_mode = self.terminal.mode().contains(TermMode::VI);
+
// Update selection.
- if self.terminal.mode().contains(TermMode::VI)
- && self.terminal.selection.as_ref().map_or(false, |s| !s.is_empty())
- {
+ if vi_mode && self.terminal.selection.as_ref().map_or(false, |s| !s.is_empty()) {
self.update_selection(self.terminal.vi_mode_cursor.point, Side::Right);
} else if self.mouse.left_button_state == ElementState::Pressed
|| self.mouse.right_button_state == ElementState::Pressed
@@ -274,8 +275,14 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
self.update_selection(point, self.mouse.cell_side);
}
- // Update dirty if actually scrolled or we're in the Vi mode.
- *self.dirty |= lines_changed != 0;
+ // Scrolling inside Vi mode moves the cursor, so start typing.
+ if vi_mode {
+ self.on_typing_start();
+ }
+
+ // Update dirty if actually scrolled or moved Vi cursor in Vi mode.
+ *self.dirty |=
+ lines_changed != 0 || (vi_mode && old_vi_cursor != self.terminal.vi_mode_cursor);
}
// Copy text selection.