diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2022-07-25 02:17:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-25 02:17:57 +0300 |
commit | b86667b2989dca71bd584227e5878c89f6888605 (patch) | |
tree | cd1c826881bc02ff4f2fcbf6866d544834522104 /alacritty/src/input.rs | |
parent | 4fce2b16f572719bc8036eed0ad06ab41e52f95a (diff) | |
download | r-alacritty-b86667b2989dca71bd584227e5878c89f6888605.tar.gz r-alacritty-b86667b2989dca71bd584227e5878c89f6888605.tar.bz2 r-alacritty-b86667b2989dca71bd584227e5878c89f6888605.zip |
Remove redundant dirty updates
In some cases dirty was set without any ui update leading
to extra redraws, this commit resolves this.
Co-authored-by: Greg Depoire--Ferrer <greg@gregdf.com>
Diffstat (limited to 'alacritty/src/input.rs')
-rw-r--r-- | alacritty/src/input.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index 9f076e1b..35aaedda 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -141,7 +141,6 @@ impl<T: EventListener> Execute<T> for Action { match self { Action::Esc(s) => { ctx.on_typing_start(); - ctx.clear_selection(); ctx.scroll(Scroll::Bottom); ctx.write_to_pty(s.clone().into_bytes()) @@ -597,6 +596,7 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> { // Move vi mode cursor to mouse click position. if self.ctx.terminal().mode().contains(TermMode::VI) && !self.ctx.search_active() { self.ctx.terminal_mut().vi_mode_cursor.point = point; + self.ctx.mark_dirty(); } } @@ -686,9 +686,11 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> { let multiplier = f64::from(self.ctx.config().terminal_config.scrolling.multiplier); self.ctx.mouse_mut().scroll_px += new_scroll_px * multiplier; - let lines = self.ctx.mouse().scroll_px / height; + let lines = (self.ctx.mouse().scroll_px / height) as i32; - self.ctx.scroll(Scroll::Delta(lines as i32)); + if lines != 0 { + self.ctx.scroll(Scroll::Delta(lines)); + } } self.ctx.mouse_mut().scroll_px %= height; |