aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/event.rs
diff options
context:
space:
mode:
authorii41 <23465321+ii41@users.noreply.github.com>2020-09-27 15:36:08 -0700
committerGitHub <noreply@github.com>2020-09-27 22:36:08 +0000
commita754d06b44139b85e8b34a71ece4477cb1caa85e (patch)
tree1733f8d17101947b6df5e1ad15b3fd64cf1db9a0 /alacritty/src/event.rs
parente9c0034f4d3ee003149fe5454942bea7ff3d98be (diff)
downloadr-alacritty-a754d06b44139b85e8b34a71ece4477cb1caa85e.tar.gz
r-alacritty-a754d06b44139b85e8b34a71ece4477cb1caa85e.tar.bz2
r-alacritty-a754d06b44139b85e8b34a71ece4477cb1caa85e.zip
Add support for single line terminals
This changes the minimum terminal dimensions from 2 lines and 2 columns, to 1 line and 2 columns. This also reworks the `SizeInfo` to store the number of columns and lines and consistently has only the terminal lines/columns stored, instead of including the message bar and search in some places of the Alacritty renderer/input. These new changes also make it easy to properly start the selection scrolling as soon as the mouse is over the message bar, instead of waiting until it is beyond it. Fixes #4207. Co-authored-by: Christian Duerr <contact@christianduerr.com>
Diffstat (limited to 'alacritty/src/event.rs')
-rw-r--r--alacritty/src/event.rs37
1 files changed, 19 insertions, 18 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index e81dc0f9..e45795dd 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -410,14 +410,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
self.goto_match(None);
}
- // Move vi cursor down if resize will pull content from history.
- if self.terminal.history_size() != 0 && self.terminal.grid().display_offset() == 0 {
- self.terminal.vi_mode_cursor.point.line += 1;
- }
-
- self.display_update_pending.dirty = true;
- self.search_state.regex = None;
- self.terminal.dirty = true;
+ self.exit_search();
}
#[inline]
@@ -429,14 +422,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
self.search_reset_state();
}
- // Move vi cursor down if resize will pull from history.
- if self.terminal.history_size() != 0 && self.terminal.grid().display_offset() == 0 {
- self.terminal.vi_mode_cursor.point.line += 1;
- }
-
- self.display_update_pending.dirty = true;
- self.search_state.regex = None;
- self.terminal.dirty = true;
+ self.exit_search();
}
#[inline]
@@ -628,6 +614,21 @@ impl<'a, N: Notify + 'a, T: EventListener> ActionContext<'a, N, T> {
self.search_state.regex = Some(regex);
}
+ /// Close the search bar.
+ fn exit_search(&mut self) {
+ // Move vi cursor down if resize will pull content from history.
+ if self.terminal.history_size() != 0
+ && self.terminal.grid().display_offset() == 0
+ && self.terminal.screen_lines() > self.terminal.vi_mode_cursor.point.line + 1
+ {
+ self.terminal.vi_mode_cursor.point.line += 1;
+ }
+
+ self.display_update_pending.dirty = true;
+ self.search_state.regex = None;
+ self.terminal.dirty = true;
+ }
+
/// Get the absolute position of the search origin.
///
/// This takes the relative motion of the viewport since the start of the search into account.
@@ -914,7 +915,7 @@ impl<N: Notify + OnResize> Processor<N> {
// Resize to event's dimensions, since no resize event is emitted on Wayland.
display_update_pending.set_dimensions(PhysicalSize::new(width, height));
- processor.ctx.size_info.dpr = scale_factor;
+ processor.ctx.window.dpr = scale_factor;
processor.ctx.terminal.dirty = true;
},
Event::Message(message) => {
@@ -1098,7 +1099,7 @@ impl<N: Notify + OnResize> Processor<N> {
// Update display if padding options were changed.
let window_config = &processor.ctx.config.ui_config.window;
- if window_config.padding != config.ui_config.window.padding
+ if window_config.padding(1.) != config.ui_config.window.padding(1.)
|| window_config.dynamic_padding != config.ui_config.window.dynamic_padding
{
processor.ctx.display_update_pending.dirty = true;