summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/tty
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_terminal/src/tty
parente9c0034f4d3ee003149fe5454942bea7ff3d98be (diff)
downloadalacritty-a754d06b44139b85e8b34a71ece4477cb1caa85e.tar.gz
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_terminal/src/tty')
-rw-r--r--alacritty_terminal/src/tty/unix.rs6
-rw-r--r--alacritty_terminal/src/tty/windows/conpty.rs8
-rw-r--r--alacritty_terminal/src/tty/windows/winpty.rs6
3 files changed, 10 insertions, 10 deletions
diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs
index c52da34d..9cce1983 100644
--- a/alacritty_terminal/src/tty/unix.rs
+++ b/alacritty_terminal/src/tty/unix.rs
@@ -357,10 +357,10 @@ pub trait ToWinsize {
impl<'a> ToWinsize for &'a SizeInfo {
fn to_winsize(&self) -> winsize {
winsize {
- ws_row: self.lines().0 as libc::c_ushort,
+ ws_row: self.screen_lines().0 as libc::c_ushort,
ws_col: self.cols().0 as libc::c_ushort,
- ws_xpixel: self.width as libc::c_ushort,
- ws_ypixel: self.height as libc::c_ushort,
+ ws_xpixel: self.width() as libc::c_ushort,
+ ws_ypixel: self.height() as libc::c_ushort,
}
}
}
diff --git a/alacritty_terminal/src/tty/windows/conpty.rs b/alacritty_terminal/src/tty/windows/conpty.rs
index b9748c8b..5469c7fe 100644
--- a/alacritty_terminal/src/tty/windows/conpty.rs
+++ b/alacritty_terminal/src/tty/windows/conpty.rs
@@ -233,12 +233,12 @@ impl OnResize for Conpty {
}
/// Helper to build a COORD from a SizeInfo, returning None in overflow cases.
-fn coord_from_sizeinfo(sizeinfo: &SizeInfo) -> Option<COORD> {
- let cols = sizeinfo.cols().0;
- let lines = sizeinfo.lines().0;
+fn coord_from_sizeinfo(size: &SizeInfo) -> Option<COORD> {
+ let cols = size.cols().0;
+ let lines = size.screen_lines().0;
if cols <= i16::MAX as usize && lines <= i16::MAX as usize {
- Some(COORD { X: sizeinfo.cols().0 as i16, Y: sizeinfo.lines().0 as i16 })
+ Some(COORD { X: cols as i16, Y: lines as i16 })
} else {
None
}
diff --git a/alacritty_terminal/src/tty/windows/winpty.rs b/alacritty_terminal/src/tty/windows/winpty.rs
index f9dd56bb..5de4b401 100644
--- a/alacritty_terminal/src/tty/windows/winpty.rs
+++ b/alacritty_terminal/src/tty/windows/winpty.rs
@@ -20,7 +20,7 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) ->
// Create config.
let mut wconfig = WinptyConfig::new(ConfigFlags::empty()).unwrap();
- wconfig.set_initial_size(size.cols().0 as i32, size.lines().0 as i32);
+ wconfig.set_initial_size(size.cols().0 as i32, size.screen_lines().0 as i32);
wconfig.set_mouse_mode(&MouseMode::Auto);
// Start agent.
@@ -60,8 +60,8 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) ->
}
impl OnResize for Agent {
- fn on_resize(&mut self, sizeinfo: &SizeInfo) {
- let (cols, lines) = (sizeinfo.cols().0, sizeinfo.lines().0);
+ fn on_resize(&mut self, size: &SizeInfo) {
+ let (cols, lines) = (size.cols().0, size.screen_lines().0);
if cols > 0 && cols <= u16::MAX as usize && lines > 0 && lines <= u16::MAX as usize {
self.set_size(cols as u16, lines as u16)
.unwrap_or_else(|_| info!("Unable to set WinPTY size, did it die?"));