From 169e25af66fe534a5091583b4b5f62dd1b7eea9b Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Thu, 22 Apr 2021 20:55:23 +0200 Subject: [PATCH 01/13] fix(ui): draw ui properly on terminal start (#323) * fix(ui): draw ui properly on terminal start * style(fmt): rustfmt --- src/client/layout.rs | 31 +++++++++++++------ src/client/panes/plugin_pane.rs | 9 ++++++ src/client/panes/terminal_pane.rs | 11 +++++++ src/client/tab.rs | 20 +++++++++++- src/tests/integration/basic.rs | 13 ++++++++ src/tests/integration/close_pane.rs | 13 ++++++++ src/tests/integration/compatibility.rs | 20 ++++++++++++ src/tests/integration/layouts.rs | 1 + src/tests/integration/move_focus_down.rs | 2 ++ src/tests/integration/move_focus_left.rs | 2 ++ src/tests/integration/move_focus_right.rs | 2 ++ src/tests/integration/move_focus_up.rs | 2 ++ src/tests/integration/resize_down.rs | 13 ++++++++ src/tests/integration/resize_left.rs | 13 ++++++++ src/tests/integration/resize_right.rs | 13 ++++++++ src/tests/integration/resize_up.rs | 13 ++++++++ src/tests/integration/tabs.rs | 8 +++++ .../integration/terminal_window_resize.rs | 8 +++++ src/tests/integration/toggle_fullscreen.rs | 2 ++ 19 files changed, 185 insertions(+), 11 deletions(-) diff --git a/src/client/layout.rs b/src/client/layout.rs index e82f9045..e28058ba 100644 --- a/src/client/layout.rs +++ b/src/client/layout.rs @@ -17,14 +17,17 @@ fn split_space_to_parts_vertically( // First fit in the parameterized sizes for size in sizes { - let columns = match size { + let (columns, max_columns) = match size { Some(SplitSize::Percent(percent)) => { - (max_width as f32 * (percent as f32 / 100.0)) as usize + ((max_width as f32 * (percent as f32 / 100.0)) as usize, None) } // TODO: round properly - Some(SplitSize::Fixed(size)) => size as usize, + Some(SplitSize::Fixed(size)) => (size as usize, Some(size as usize)), None => { parts_to_grow.push(current_x_position); - 1 // This is grown later on + ( + 1, // This is grown later on + None, + ) } }; split_parts.push(PositionAndSize { @@ -32,6 +35,8 @@ fn split_space_to_parts_vertically( y: space_to_split.y, columns, rows: space_to_split.rows, + max_columns, + ..Default::default() }); current_width += columns; current_x_position += columns + 1; // 1 for gap @@ -80,14 +85,18 @@ fn split_space_to_parts_horizontally( let mut parts_to_grow = Vec::new(); for size in sizes { - let rows = match size { - Some(SplitSize::Percent(percent)) => { - (max_height as f32 * (percent as f32 / 100.0)) as usize - } // TODO: round properly - Some(SplitSize::Fixed(size)) => size as usize, + let (rows, max_rows) = match size { + Some(SplitSize::Percent(percent)) => ( + (max_height as f32 * (percent as f32 / 100.0)) as usize, + None, + ), // TODO: round properly + Some(SplitSize::Fixed(size)) => (size as usize, Some(size as usize)), None => { parts_to_grow.push(current_y_position); - 1 // This is grown later on + ( + 1, // This is grown later on + None, + ) } }; split_parts.push(PositionAndSize { @@ -95,6 +104,8 @@ fn split_space_to_parts_horizontally( y: current_y_position, columns: space_to_split.columns, rows, + max_rows, + ..Default::default() }); current_height += rows; current_y_position += rows + 1; // 1 for gap diff --git a/src/client/panes/plugin_pane.rs b/src/client/panes/plugin_pane.rs index 24daec08..a5b99bb5 100644 --- a/src/client/panes/plugin_pane.rs +++ b/src/client/panes/plugin_pane.rs @@ -13,6 +13,7 @@ pub struct PluginPane { pub position_and_size_override: Option, pub send_plugin_instructions: SenderWithContext, pub max_height: Option, + pub max_width: Option, } impl PluginPane { @@ -30,6 +31,7 @@ impl PluginPane { position_and_size_override: None, send_plugin_instructions, max_height: None, + max_width: None, } } } @@ -73,6 +75,7 @@ impl Pane for PluginPane { y, rows: size.rows, columns: size.columns, + ..Default::default() }; self.position_and_size_override = Some(position_and_size_override); self.should_render = true; @@ -108,6 +111,9 @@ impl Pane for PluginPane { fn set_max_height(&mut self, max_height: usize) { self.max_height = Some(max_height); } + fn set_max_width(&mut self, max_width: usize) { + self.max_width = Some(max_width); + } fn render(&mut self) -> Option { // if self.should_render { if true { @@ -195,6 +201,9 @@ impl Pane for PluginPane { fn max_height(&self) -> Option { self.max_height } + fn max_width(&self) -> Option { + self.max_width + } fn invisible_borders(&self) -> bool { self.invisible_borders } diff --git a/src/client/panes/terminal_pane.rs b/src/client/panes/terminal_pane.rs index 5d63a100..51f735d4 100644 --- a/src/client/panes/terminal_pane.rs +++ b/src/client/panes/terminal_pane.rs @@ -23,6 +23,8 @@ pub struct PositionAndSize { pub y: usize, pub rows: usize, pub columns: usize, + pub max_rows: Option, + pub max_columns: Option, } impl From for PositionAndSize { @@ -42,6 +44,7 @@ pub struct TerminalPane { pub position_and_size: PositionAndSize, pub position_and_size_override: Option, pub max_height: Option, + pub max_width: Option, vte_parser: vte::Parser, } @@ -73,6 +76,7 @@ impl Pane for TerminalPane { y, rows: size.rows, columns: size.columns, + ..Default::default() }; self.position_and_size_override = Some(position_and_size_override); self.reflow_lines(); @@ -147,12 +151,18 @@ impl Pane for TerminalPane { fn set_max_height(&mut self, max_height: usize) { self.max_height = Some(max_height); } + fn set_max_width(&mut self, max_width: usize) { + self.max_width = Some(max_width); + } fn set_invisible_borders(&mut self, _invisible_borders: bool) { unimplemented!(); } fn max_height(&self) -> Option { self.max_height } + fn max_width(&self) -> Option { + self.max_width + } fn render(&mut self) -> Option { // FIXME: // the below conditional is commented out because it causes several bugs: @@ -284,6 +294,7 @@ impl TerminalPane { position_and_size, position_and_size_override: None, max_height: None, + max_width: None, vte_parser: vte::Parser::new(), } } diff --git a/src/client/tab.rs b/src/client/tab.rs index acccde3a..04d53f79 100644 --- a/src/client/tab.rs +++ b/src/client/tab.rs @@ -104,6 +104,7 @@ pub trait Pane { fn set_selectable(&mut self, selectable: bool); fn set_invisible_borders(&mut self, invisible_borders: bool); fn set_max_height(&mut self, max_height: usize); + fn set_max_width(&mut self, max_width: usize); fn render(&mut self) -> Option; fn pid(&self) -> PaneId; fn reduce_height_down(&mut self, count: usize); @@ -170,6 +171,7 @@ pub trait Pane { y: self.y(), columns: self.columns(), rows: self.rows(), + ..Default::default() } } fn can_increase_height_by(&self, increase_by: usize) -> bool { @@ -260,6 +262,7 @@ impl Tab { y: 0, rows: self.full_screen_ws.rows, columns: self.full_screen_ws.columns, + ..Default::default() }; self.panes_to_hide.clear(); let positions_in_layout = layout.position_panes_in_space(&free_space); @@ -270,6 +273,12 @@ impl Tab { match positions_and_size.next() { Some((_, position_and_size)) => { terminal_pane.reset_size_and_position_override(); + if let Some(max_rows) = position_and_size.max_rows { + terminal_pane.set_max_height(max_rows); + } + if let Some(max_columns) = position_and_size.max_columns { + terminal_pane.set_max_width(max_columns); + } terminal_pane.change_pos_and_size(&position_and_size); self.os_api.set_terminal_size_using_fd( *pid, @@ -294,11 +303,17 @@ impl Tab { .send(PluginInstruction::Load(pid_tx, plugin.clone())) .unwrap(); let pid = pid_rx.recv().unwrap(); - let new_plugin = PluginPane::new( + let mut new_plugin = PluginPane::new( pid, *position_and_size, self.send_plugin_instructions.clone(), ); + if let Some(max_rows) = position_and_size.max_rows { + new_plugin.set_max_height(max_rows); + } + if let Some(max_columns) = position_and_size.max_columns { + new_plugin.set_max_width(max_columns); + } self.panes.insert(PaneId::Plugin(pid), Box::new(new_plugin)); // Send an initial mode update to the newly loaded plugin only! self.send_plugin_instructions @@ -381,6 +396,7 @@ impl Tab { columns: terminal_to_split.columns(), x: terminal_to_split.x(), y: terminal_to_split.y(), + ..Default::default() }; if terminal_to_split.rows() * CURSOR_HEIGHT_WIDTH_RATIO > terminal_to_split.columns() && terminal_to_split.rows() > terminal_to_split.min_height() * 2 @@ -459,6 +475,7 @@ impl Tab { y: active_pane.y(), rows: active_pane.rows(), columns: active_pane.columns(), + ..Default::default() }; let (top_winsize, bottom_winsize) = split_horizontally_with_gap(&terminal_ws); @@ -515,6 +532,7 @@ impl Tab { y: active_pane.y(), rows: active_pane.rows(), columns: active_pane.columns(), + ..Default::default() }; let (left_winsize, right_winsize) = split_vertically_with_gap(&terminal_ws); diff --git a/src/tests/integration/basic.rs b/src/tests/integration/basic.rs index e57f8c75..9b1b2bdd 100644 --- a/src/tests/integration/basic.rs +++ b/src/tests/integration/basic.rs @@ -22,6 +22,7 @@ pub fn starts_with_one_terminal() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[&QUIT]); @@ -44,6 +45,7 @@ pub fn split_terminals_vertically() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &QUIT]); @@ -66,6 +68,7 @@ pub fn split_terminals_horizontally() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &QUIT]); @@ -89,6 +92,7 @@ pub fn split_largest_terminal() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -117,6 +121,7 @@ pub fn cannot_split_terminals_vertically_when_active_terminal_is_too_small() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_RIGHT_IN_PANE_MODE, &QUIT]); @@ -139,6 +144,7 @@ pub fn cannot_split_terminals_horizontally_when_active_terminal_is_too_small() { rows: 4, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[&PANE_MODE, &SPLIT_DOWN_IN_PANE_MODE, &QUIT]); @@ -161,6 +167,7 @@ pub fn cannot_split_largest_terminal_when_there_is_no_room() { rows: 4, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[&PANE_MODE, &SPAWN_TERMINAL_IN_PANE_MODE, &QUIT]); @@ -183,6 +190,7 @@ pub fn scrolling_up_inside_a_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -213,6 +221,7 @@ pub fn scrolling_down_inside_a_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -245,6 +254,7 @@ pub fn scrolling_page_up_inside_a_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -274,6 +284,7 @@ pub fn scrolling_page_down_inside_a_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -308,6 +319,7 @@ pub fn max_panes() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -339,6 +351,7 @@ pub fn toggle_focused_pane_fullscreen() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/close_pane.rs b/src/tests/integration/close_pane.rs index 7421ba37..c7ce2038 100644 --- a/src/tests/integration/close_pane.rs +++ b/src/tests/integration/close_pane.rs @@ -30,6 +30,7 @@ pub fn close_pane_with_another_pane_above_it() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -66,6 +67,7 @@ pub fn close_pane_with_another_pane_below_it() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -101,6 +103,7 @@ pub fn close_pane_with_another_pane_to_the_left() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -135,6 +138,7 @@ pub fn close_pane_with_another_pane_to_the_right() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -172,6 +176,7 @@ pub fn close_pane_with_multiple_panes_above_it() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -212,6 +217,7 @@ pub fn close_pane_with_multiple_panes_below_it() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -250,6 +256,7 @@ pub fn close_pane_with_multiple_panes_to_the_left() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -290,6 +297,7 @@ pub fn close_pane_with_multiple_panes_to_the_right() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -328,6 +336,7 @@ pub fn close_pane_with_multiple_panes_above_it_away_from_screen_edges() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -388,6 +397,7 @@ pub fn close_pane_with_multiple_panes_below_it_away_from_screen_edges() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -446,6 +456,7 @@ pub fn close_pane_with_multiple_panes_to_the_left_away_from_screen_edges() { rows: 30, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -504,6 +515,7 @@ pub fn close_pane_with_multiple_panes_to_the_right_away_from_screen_edges() { rows: 30, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -552,6 +564,7 @@ pub fn closing_last_pane_exits_app() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs index 229c259f..59c5c54d 100644 --- a/src/tests/integration/compatibility.rs +++ b/src/tests/integration/compatibility.rs @@ -36,6 +36,7 @@ pub fn run_bandwhich_from_fish_shell() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "fish_and_bandwhich"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -59,6 +60,7 @@ pub fn fish_tab_completion_options() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "fish_tab_completion_options"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -87,6 +89,7 @@ pub fn fish_select_tab_completion_options() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "fish_select_tab_completion_options"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -119,6 +122,7 @@ pub fn vim_scroll_region_down() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "vim_scroll_region_down"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -148,6 +152,7 @@ pub fn vim_ctrl_d() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "vim_ctrl_d"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -176,6 +181,7 @@ pub fn vim_ctrl_u() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "vim_ctrl_u"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -199,6 +205,7 @@ pub fn htop() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "htop"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -222,6 +229,7 @@ pub fn htop_scrolling() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "htop_scrolling"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -245,6 +253,7 @@ pub fn htop_right_scrolling() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "htop_right_scrolling"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -276,6 +285,7 @@ pub fn vim_overwrite() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "vim_overwrite"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -302,6 +312,7 @@ pub fn clear_scroll_region() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "clear_scroll_region"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -325,6 +336,7 @@ pub fn display_tab_characters_properly() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "tab_characters"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -348,6 +360,7 @@ pub fn neovim_insert_mode() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "nvim_insert"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -373,6 +386,7 @@ pub fn bash_cursor_linewrap() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "bash_cursor_linewrap"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -398,6 +412,7 @@ pub fn fish_paste_multiline() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "fish_paste_multiline"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -421,6 +436,7 @@ pub fn git_log() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "git_log"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -446,6 +462,7 @@ pub fn git_diff_scrollup() { rows: 28, x: 0, y: 0, + ..Default::default() }; let fixture_name = "git_diff_scrollup"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -469,6 +486,7 @@ pub fn emacs_longbuf() { rows: 60, x: 0, y: 0, + ..Default::default() }; let fixture_name = "emacs_longbuf_tutorial"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -492,6 +510,7 @@ pub fn top_and_quit() { rows: 56, x: 0, y: 0, + ..Default::default() }; let fixture_name = "top_and_quit"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -521,6 +540,7 @@ pub fn exa_plus_omf_theme() { rows: 56, x: 0, y: 0, + ..Default::default() }; let fixture_name = "exa_plus_omf_theme"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); diff --git a/src/tests/integration/layouts.rs b/src/tests/integration/layouts.rs index 3fb62715..78956f1f 100644 --- a/src/tests/integration/layouts.rs +++ b/src/tests/integration/layouts.rs @@ -18,6 +18,7 @@ pub fn accepts_basic_layout() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[&QUIT]); diff --git a/src/tests/integration/move_focus_down.rs b/src/tests/integration/move_focus_down.rs index 430113c0..7066dce0 100644 --- a/src/tests/integration/move_focus_down.rs +++ b/src/tests/integration/move_focus_down.rs @@ -21,6 +21,7 @@ pub fn move_focus_down() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -50,6 +51,7 @@ pub fn move_focus_down_to_the_largest_overlap() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/move_focus_left.rs b/src/tests/integration/move_focus_left.rs index f5d4e025..3a5430c0 100644 --- a/src/tests/integration/move_focus_left.rs +++ b/src/tests/integration/move_focus_left.rs @@ -21,6 +21,7 @@ pub fn move_focus_left() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -49,6 +50,7 @@ pub fn move_focus_left_to_the_largest_overlap() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/move_focus_right.rs b/src/tests/integration/move_focus_right.rs index 24147d3e..d0e21708 100644 --- a/src/tests/integration/move_focus_right.rs +++ b/src/tests/integration/move_focus_right.rs @@ -21,6 +21,7 @@ pub fn move_focus_right() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -50,6 +51,7 @@ pub fn move_focus_right_to_the_largest_overlap() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/move_focus_up.rs b/src/tests/integration/move_focus_up.rs index a5c48f11..292d969f 100644 --- a/src/tests/integration/move_focus_up.rs +++ b/src/tests/integration/move_focus_up.rs @@ -21,6 +21,7 @@ pub fn move_focus_up() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -49,6 +50,7 @@ pub fn move_focus_up_to_the_largest_overlap() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/resize_down.rs b/src/tests/integration/resize_down.rs index 773eaa86..68f8bb41 100644 --- a/src/tests/integration/resize_down.rs +++ b/src/tests/integration/resize_down.rs @@ -31,6 +31,7 @@ pub fn resize_down_with_pane_above() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -69,6 +70,7 @@ pub fn resize_down_with_pane_below() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -112,6 +114,7 @@ pub fn resize_down_with_panes_above_and_below() { rows: 25, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -153,6 +156,7 @@ pub fn resize_down_with_multiple_panes_above() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -197,6 +201,7 @@ pub fn resize_down_with_panes_above_aligned_left_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -243,6 +248,7 @@ pub fn resize_down_with_panes_below_aligned_left_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -288,6 +294,7 @@ pub fn resize_down_with_panes_above_aligned_right_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -331,6 +338,7 @@ pub fn resize_down_with_panes_below_aligned_right_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -375,6 +383,7 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -422,6 +431,7 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -471,6 +481,7 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_panes_to_the_lef rows: 40, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -537,6 +548,7 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_to_the_left_and_ rows: 40, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -603,6 +615,7 @@ pub fn cannot_resize_down_when_pane_below_is_at_minimum_height() { rows: 7, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/resize_left.rs b/src/tests/integration/resize_left.rs index a9d229d9..2229e236 100644 --- a/src/tests/integration/resize_left.rs +++ b/src/tests/integration/resize_left.rs @@ -27,6 +27,7 @@ pub fn resize_left_with_pane_to_the_left() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -63,6 +64,7 @@ pub fn resize_left_with_pane_to_the_right() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -100,6 +102,7 @@ pub fn resize_left_with_panes_to_the_left_and_right() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -139,6 +142,7 @@ pub fn resize_left_with_multiple_panes_to_the_left() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -181,6 +185,7 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -225,6 +230,7 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -266,6 +272,7 @@ pub fn resize_left_with_panes_to_the_left_aligned_bottom_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -309,6 +316,7 @@ pub fn resize_left_with_panes_to_the_right_aligned_bottom_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -353,6 +361,7 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_current_pa rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -400,6 +409,7 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_current_p rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -449,6 +459,7 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abov rows: 40, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -516,6 +527,7 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_panes_abo rows: 40, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -582,6 +594,7 @@ pub fn cannot_resize_left_when_pane_to_the_left_is_at_minimum_width() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/resize_right.rs b/src/tests/integration/resize_right.rs index fef33e84..9545cac9 100644 --- a/src/tests/integration/resize_right.rs +++ b/src/tests/integration/resize_right.rs @@ -27,6 +27,7 @@ pub fn resize_right_with_pane_to_the_left() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -63,6 +64,7 @@ pub fn resize_right_with_pane_to_the_right() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -100,6 +102,7 @@ pub fn resize_right_with_panes_to_the_left_and_right() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -139,6 +142,7 @@ pub fn resize_right_with_multiple_panes_to_the_left() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -181,6 +185,7 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -225,6 +230,7 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -266,6 +272,7 @@ pub fn resize_right_with_panes_to_the_left_aligned_bottom_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -309,6 +316,7 @@ pub fn resize_right_with_panes_to_the_right_aligned_bottom_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -353,6 +361,7 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_current_p rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -400,6 +409,7 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_current_ rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -449,6 +459,7 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abo rows: 40, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -515,6 +526,7 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_panes_ab rows: 40, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -581,6 +593,7 @@ pub fn cannot_resize_right_when_pane_to_the_left_is_at_minimum_width() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/resize_up.rs b/src/tests/integration/resize_up.rs index 5f720172..ae39d843 100644 --- a/src/tests/integration/resize_up.rs +++ b/src/tests/integration/resize_up.rs @@ -29,6 +29,7 @@ pub fn resize_up_with_pane_above() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -67,6 +68,7 @@ pub fn resize_up_with_pane_below() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -109,6 +111,7 @@ pub fn resize_up_with_panes_above_and_below() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -149,6 +152,7 @@ pub fn resize_up_with_multiple_panes_above() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -191,6 +195,7 @@ pub fn resize_up_with_panes_above_aligned_left_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -237,6 +242,7 @@ pub fn resize_up_with_panes_below_aligned_left_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -282,6 +288,7 @@ pub fn resize_up_with_panes_above_aligned_right_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -325,6 +332,7 @@ pub fn resize_up_with_panes_below_aligned_right_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -369,6 +377,7 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -416,6 +425,7 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_current_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -465,6 +475,7 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_panes_to_the_left_ rows: 40, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -531,6 +542,7 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_to_the_left_and_ri rows: 40, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -597,6 +609,7 @@ pub fn cannot_resize_up_when_pane_above_is_at_minimum_height() { rows: 7, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/tabs.rs b/src/tests/integration/tabs.rs index ee75b3a9..183b1b2a 100644 --- a/src/tests/integration/tabs.rs +++ b/src/tests/integration/tabs.rs @@ -22,6 +22,7 @@ pub fn open_new_tab() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -51,6 +52,7 @@ pub fn switch_to_prev_tab() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -81,6 +83,7 @@ pub fn switch_to_next_tab() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -111,6 +114,7 @@ pub fn close_tab() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -141,6 +145,7 @@ pub fn close_last_pane_in_a_tab() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -172,6 +177,7 @@ pub fn close_the_middle_tab() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -205,6 +211,7 @@ pub fn close_the_tab_that_has_a_pane_in_fullscreen() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -243,6 +250,7 @@ pub fn closing_last_tab_exits_the_app() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/terminal_window_resize.rs b/src/tests/integration/terminal_window_resize.rs index ab73d24e..1ee5828a 100644 --- a/src/tests/integration/terminal_window_resize.rs +++ b/src/tests/integration/terminal_window_resize.rs @@ -17,6 +17,7 @@ pub fn window_width_decrease_with_one_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[&QUIT]); @@ -25,6 +26,7 @@ pub fn window_width_decrease_with_one_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }); let opts = CliArgs::default(); start(Box::new(fake_input_output.clone()), opts); @@ -46,6 +48,7 @@ pub fn window_width_increase_with_one_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[&QUIT]); @@ -54,6 +57,7 @@ pub fn window_width_increase_with_one_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }); let opts = CliArgs::default(); start(Box::new(fake_input_output.clone()), opts); @@ -75,6 +79,7 @@ pub fn window_height_increase_with_one_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[&QUIT]); @@ -83,6 +88,7 @@ pub fn window_height_increase_with_one_pane() { rows: 30, x: 0, y: 0, + ..Default::default() }); let opts = CliArgs::default(); start(Box::new(fake_input_output.clone()), opts); @@ -104,6 +110,7 @@ pub fn window_width_and_height_decrease_with_one_pane() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[&QUIT]); @@ -112,6 +119,7 @@ pub fn window_width_and_height_decrease_with_one_pane() { rows: 10, x: 0, y: 0, + ..Default::default() }); let opts = CliArgs::default(); start(Box::new(fake_input_output.clone()), opts); diff --git a/src/tests/integration/toggle_fullscreen.rs b/src/tests/integration/toggle_fullscreen.rs index 840302e5..c36849f7 100644 --- a/src/tests/integration/toggle_fullscreen.rs +++ b/src/tests/integration/toggle_fullscreen.rs @@ -21,6 +21,7 @@ pub fn adding_new_terminal_in_fullscreen() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -50,6 +51,7 @@ pub fn move_focus_is_disabled_in_fullscreen() { rows: 20, x: 0, y: 0, + ..Default::default() }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ From c809e2b8b0babe3209a8db444712c41dec722cd3 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Thu, 22 Apr 2021 20:56:57 +0200 Subject: [PATCH 02/13] docs(changelog): update ui fix --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3ac461d..c1c693ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * Terminal fix: do not clear line if it's not there (https://github.com/zellij-org/zellij/pull/289) * Do not allow opening new pane on the status bar (https://github.com/zellij-org/zellij/pull/314) * Allow scrolling by full pages (https://github.com/zellij-org/zellij/pull/298) -* Reduce crate size by 4.8MB using `cargo diet`, to 77kB (https://github.com/zellij-org/zellij/pull/293) +* Reduce crate size by 4.8MB using `cargo diet`, to 77kB (https://github.com/zellij-org/zellij/pull/293) +* Draw UI properly when instantiated as the default terminal command (https://github.com/zellij-org/zellij/pull/323) ## [0.5.0] - 2021-04-20 Beta release with all the things From f2fa8839d414ff4cdaeeb7aedfc5cbccba0dc920 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Thu, 22 Apr 2021 20:59:20 +0200 Subject: [PATCH 03/13] chore(version): 0.5.1 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa8b6552..b6ece4a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2184,7 +2184,7 @@ dependencies = [ [[package]] name = "zellij" -version = "0.5.0" +version = "0.5.1" dependencies = [ "ansi_term 0.12.1", "async-std", diff --git a/Cargo.toml b/Cargo.toml index 52446faf..7c811ae5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zellij" -version = "0.5.0" +version = "0.5.1" authors = ["Aram Drevekenin "] edition = "2018" description = "A terminal workspace with batteries included" From f5b781c66f0a541e6382d2fef444470a87273c53 Mon Sep 17 00:00:00 2001 From: Dante Pippi <6619666+dantepippi@users.noreply.github.com> Date: Tue, 20 Apr 2021 23:58:38 -0300 Subject: [PATCH 04/13] Adding field active_at and using it to sort panes Using last activity time to determine which pane was previously active when moving back to a direction. Changing active_at type to Instant --- src/client/panes/plugin_pane.rs | 15 +++++++++++++-- src/client/panes/terminal_pane.rs | 11 +++++++++++ src/client/tab.rs | 12 ++++++++---- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/client/panes/plugin_pane.rs b/src/client/panes/plugin_pane.rs index a5b99bb5..21480ac2 100644 --- a/src/client/panes/plugin_pane.rs +++ b/src/client/panes/plugin_pane.rs @@ -1,9 +1,10 @@ use crate::{common::SenderWithContext, pty_bus::VteBytes, tab::Pane, wasm_vm::PluginInstruction}; -use std::{sync::mpsc::channel, unimplemented}; - use crate::panes::{PaneId, PositionAndSize}; +use std::time::Instant; +use std::{sync::mpsc::channel, unimplemented}; + pub struct PluginPane { pub pid: u32, pub should_render: bool, @@ -14,6 +15,7 @@ pub struct PluginPane { pub send_plugin_instructions: SenderWithContext, pub max_height: Option, pub max_width: Option, + pub active_at: Instant, } impl PluginPane { @@ -32,6 +34,7 @@ impl PluginPane { send_plugin_instructions, max_height: None, max_width: None, + active_at: Instant::now(), } } } @@ -207,4 +210,12 @@ impl Pane for PluginPane { fn invisible_borders(&self) -> bool { self.invisible_borders } + + fn active_at(&self) -> Instant { + self.active_at + } + + fn set_active_at(&mut self, time: Instant) { + self.active_at = time; + } } diff --git a/src/client/panes/terminal_pane.rs b/src/client/panes/terminal_pane.rs index 51f735d4..ddb10889 100644 --- a/src/client/panes/terminal_pane.rs +++ b/src/client/panes/terminal_pane.rs @@ -2,6 +2,7 @@ use crate::tab::Pane; use ::nix::pty::Winsize; use ::std::os::unix::io::RawFd; use std::fmt::Debug; +use std::time::Instant; use crate::panes::grid::Grid; use crate::panes::terminal_character::{ @@ -45,6 +46,7 @@ pub struct TerminalPane { pub position_and_size_override: Option, pub max_height: Option, pub max_width: Option, + pub active_at: Instant, vte_parser: vte::Parser, } @@ -282,6 +284,14 @@ impl Pane for TerminalPane { self.grid.reset_viewport(); self.grid.should_render = true; } + + fn active_at(&self) -> Instant { + self.active_at + } + + fn set_active_at(&mut self, time: Instant) { + self.active_at = time; + } } impl TerminalPane { @@ -296,6 +306,7 @@ impl TerminalPane { max_height: None, max_width: None, vte_parser: vte::Parser::new(), + active_at: Instant::now(), } } pub fn get_x(&self) -> usize { diff --git a/src/client/tab.rs b/src/client/tab.rs index 04d53f79..af48d3fe 100644 --- a/src/client/tab.rs +++ b/src/client/tab.rs @@ -13,6 +13,7 @@ use crate::wasm_vm::PluginInstruction; use crate::{boundaries::Boundaries, panes::PluginPane}; use serde::{Deserialize, Serialize}; use std::os::unix::io::RawFd; +use std::time::Instant; use std::{ cmp::Reverse, collections::{BTreeMap, HashSet}, @@ -122,6 +123,8 @@ pub trait Pane { fn scroll_up(&mut self, count: usize); fn scroll_down(&mut self, count: usize); fn clear_scroll(&mut self); + fn active_at(&self) -> Instant; + fn set_active_at(&mut self, instant: Instant); fn right_boundary_x_coords(&self) -> usize { self.x() + self.columns() @@ -700,6 +703,7 @@ impl Tab { if !self.panes_to_hide.contains(&pane.pid()) { match self.active_terminal.unwrap() == pane.pid() { true => { + pane.set_active_at(Instant::now()); boundaries.add_rect(pane.as_ref(), self.mode_info.mode, Some(colors::GREEN)) } false => boundaries.add_rect(pane.as_ref(), self.mode_info.mode, None), @@ -1837,7 +1841,7 @@ impl Tab { .filter(|(_, (_, c))| { c.is_directly_left_of(active) && c.horizontally_overlaps_with(active) }) - .max_by_key(|(_, (_, c))| c.get_horizontal_overlap_with(active)) + .max_by_key(|(_, (_, c))| c.active_at()) .map(|(_, (pid, _))| pid); match next_index { Some(&p) => { @@ -1867,7 +1871,7 @@ impl Tab { .filter(|(_, (_, c))| { c.is_directly_below(active) && c.vertically_overlaps_with(active) }) - .max_by_key(|(_, (_, c))| c.get_vertical_overlap_with(active)) + .max_by_key(|(_, (_, c))| c.active_at()) .map(|(_, (pid, _))| pid); match next_index { Some(&p) => { @@ -1897,7 +1901,7 @@ impl Tab { .filter(|(_, (_, c))| { c.is_directly_above(active) && c.vertically_overlaps_with(active) }) - .max_by_key(|(_, (_, c))| c.get_vertical_overlap_with(active)) + .max_by_key(|(_, (_, c))| c.active_at()) .map(|(_, (pid, _))| pid); match next_index { Some(&p) => { @@ -1927,7 +1931,7 @@ impl Tab { .filter(|(_, (_, c))| { c.is_directly_right_of(active) && c.horizontally_overlaps_with(active) }) - .max_by_key(|(_, (_, c))| c.get_horizontal_overlap_with(active)) + .max_by_key(|(_, (_, c))| c.active_at()) .map(|(_, (pid, _))| pid); match next_index { Some(&p) => { From 4f7ad31cf61e926ae9ba7134894c03871978b50f Mon Sep 17 00:00:00 2001 From: Dante Pippi <6619666+dantepippi@users.noreply.github.com> Date: Thu, 22 Apr 2021 21:07:55 -0300 Subject: [PATCH 05/13] Changing tests to test the new behavior Previous behavior was to go to the largest overlap. Now it should go to the most recently used pane. Used cargo insta review to update the snapshots. --- src/tests/integration/move_focus_down.rs | 2 +- src/tests/integration/move_focus_left.rs | 2 +- src/tests/integration/move_focus_right.rs | 2 +- src/tests/integration/move_focus_up.rs | 2 +- ...ve_focus_down__move_focus_down_to_the_largest_overlap.snap | 2 +- ...ve_focus_left__move_focus_left_to_the_largest_overlap.snap | 4 ++-- ..._focus_right__move_focus_right_to_the_largest_overlap.snap | 4 ++-- ...__move_focus_up__move_focus_up_to_the_largest_overlap.snap | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/tests/integration/move_focus_down.rs b/src/tests/integration/move_focus_down.rs index 7066dce0..273696ae 100644 --- a/src/tests/integration/move_focus_down.rs +++ b/src/tests/integration/move_focus_down.rs @@ -45,7 +45,7 @@ pub fn move_focus_down() { } #[test] -pub fn move_focus_down_to_the_largest_overlap() { +pub fn move_focus_down_to_the_most_recently_used_pane() { let fake_win_size = PositionAndSize { columns: 121, rows: 20, diff --git a/src/tests/integration/move_focus_left.rs b/src/tests/integration/move_focus_left.rs index 3a5430c0..e36b8fcf 100644 --- a/src/tests/integration/move_focus_left.rs +++ b/src/tests/integration/move_focus_left.rs @@ -44,7 +44,7 @@ pub fn move_focus_left() { } #[test] -pub fn move_focus_left_to_the_largest_overlap() { +pub fn move_focus_left_to_the_most_recently_used_pane() { let fake_win_size = PositionAndSize { columns: 121, rows: 20, diff --git a/src/tests/integration/move_focus_right.rs b/src/tests/integration/move_focus_right.rs index d0e21708..88d86a26 100644 --- a/src/tests/integration/move_focus_right.rs +++ b/src/tests/integration/move_focus_right.rs @@ -45,7 +45,7 @@ pub fn move_focus_right() { } #[test] -pub fn move_focus_right_to_the_largest_overlap() { +pub fn move_focus_right_to_the_most_recently_used_pane() { let fake_win_size = PositionAndSize { columns: 121, rows: 20, diff --git a/src/tests/integration/move_focus_up.rs b/src/tests/integration/move_focus_up.rs index 292d969f..d4ef6c8f 100644 --- a/src/tests/integration/move_focus_up.rs +++ b/src/tests/integration/move_focus_up.rs @@ -44,7 +44,7 @@ pub fn move_focus_up() { } #[test] -pub fn move_focus_up_to_the_largest_overlap() { +pub fn move_focus_up_to_the_most_recently_used_pane() { let fake_win_size = PositionAndSize { columns: 121, rows: 20, diff --git a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_down__move_focus_down_to_the_largest_overlap.snap b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_down__move_focus_down_to_the_largest_overlap.snap index 24cdf0f5..1c53690e 100644 --- a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_down__move_focus_down_to_the_largest_overlap.snap +++ b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_down__move_focus_down_to_the_largest_overlap.snap @@ -22,4 +22,4 @@ a │line18-bbbbbbbbbb line19-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line17-bbbbbbbbbbbbbbbbbbbbbb aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line19-bbbbbbbbbbbbbbbbbbbbbbb│line18-bbbbbbbbbbbbbbbbbbbbbb a │bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line19-bbbbbbbbbbbbbbbbbbbbbb -prompt $ █ │prompt $ │prompt $ +prompt $ │prompt $ │prompt $ █ diff --git a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_left__move_focus_left_to_the_largest_overlap.snap b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_left__move_focus_left_to_the_largest_overlap.snap index 8e35b971..b175a531 100644 --- a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_left__move_focus_left_to_the_largest_overlap.snap +++ b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_left__move_focus_left_to_the_largest_overlap.snap @@ -12,7 +12,7 @@ a │line6-bbbbbbbbbbb line19-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line7-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line8-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb a │line9-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb -prompt $ █ │line10-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +prompt $ │line10-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ────────────────────────────────────────────────────────────┤line11-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line12-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line13-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb @@ -22,4 +22,4 @@ prompt $ │line15-bbbbbbbbbb line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb line19-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line19-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb -prompt $ │prompt $ +prompt $ █ │prompt $ diff --git a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_right__move_focus_right_to_the_largest_overlap.snap b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_right__move_focus_right_to_the_largest_overlap.snap index 0b745b04..312b8c04 100644 --- a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_right__move_focus_right_to_the_largest_overlap.snap +++ b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_right__move_focus_right_to_the_largest_overlap.snap @@ -12,7 +12,7 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line16-bbbbbbbbbb a │line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb line16-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line19-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb -a │prompt $ █ +a │prompt $ line17-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa├──────────────────────────────────────────────────────────── aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb a │line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb @@ -22,4 +22,4 @@ a ├───── line19-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb a │line19-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb -prompt $ │prompt $ +prompt $ │prompt $ █ diff --git a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_up__move_focus_up_to_the_largest_overlap.snap b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_up__move_focus_up_to_the_largest_overlap.snap index f09d8fa6..188bc9c4 100644 --- a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_up__move_focus_up_to_the_largest_overlap.snap +++ b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_up__move_focus_up_to_the_largest_overlap.snap @@ -12,7 +12,7 @@ a │line18-bbbbbbbbbb line19-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line17-bbbbbbbbbbbbbbbbbbbbbb aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line19-bbbbbbbbbbbbbbbbbbbbbbb│line18-bbbbbbbbbbbbbbbbbbbbbb a │bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line19-bbbbbbbbbbbbbbbbbbbbbb -prompt $ █ │prompt $ │prompt $ +prompt $ │prompt $ │prompt $ █ ────────────────────────────────────────────────────────────┴──────────────────────────────┴───────────────────────────── line12-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa line13-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa From 068136b52371e60f935e6b117ecd8e387b38b665 Mon Sep 17 00:00:00 2001 From: Dante Pippi <6619666+dantepippi@users.noreply.github.com> Date: Thu, 22 Apr 2021 21:28:38 -0300 Subject: [PATCH 06/13] Fixing snapshots --- ...s_down_to_the_most_recently_used_pane.snap | 25 +++++++++++++++++++ ...s_left_to_the_most_recently_used_pane.snap | 25 +++++++++++++++++++ ..._right_to_the_most_recently_used_pane.snap | 25 +++++++++++++++++++ ...cus_up_to_the_most_recently_used_pane.snap | 25 +++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 src/tests/integration/snapshots/zellij__tests__integration__move_focus_down__move_focus_down_to_the_most_recently_used_pane.snap create mode 100644 src/tests/integration/snapshots/zellij__tests__integration__move_focus_left__move_focus_left_to_the_most_recently_used_pane.snap create mode 100644 src/tests/integration/snapshots/zellij__tests__integration__move_focus_right__move_focus_right_to_the_most_recently_used_pane.snap create mode 100644 src/tests/integration/snapshots/zellij__tests__integration__move_focus_up__move_focus_up_to_the_most_recently_used_pane.snap diff --git a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_down__move_focus_down_to_the_most_recently_used_pane.snap b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_down__move_focus_down_to_the_most_recently_used_pane.snap new file mode 100644 index 00000000..1c53690e --- /dev/null +++ b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_down__move_focus_down_to_the_most_recently_used_pane.snap @@ -0,0 +1,25 @@ +--- +source: src/tests/integration/move_focus_down.rs +expression: snapshot_before_quit + +--- +line11-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line12-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line13-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line14-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line15-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line16-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line17-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line18-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line19-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +prompt $ +────────────────────────────────────────────────────────────┬──────────────────────────────┬───────────────────────────── +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line16-bbbbbbbbbbbbbbbbbbbbbbb│line12-bbbbbbbbbbbbbbbbbbbbbb +a │bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line13-bbbbbbbbbbbbbbbbbbbbbb +line18-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line17-bbbbbbbbbbbbbbbbbbbbbbb│line14-bbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line15-bbbbbbbbbbbbbbbbbbbbbb +a │line18-bbbbbbbbbbbbbbbbbbbbbbb│line16-bbbbbbbbbbbbbbbbbbbbbb +line19-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line17-bbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line19-bbbbbbbbbbbbbbbbbbbbbbb│line18-bbbbbbbbbbbbbbbbbbbbbb +a │bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line19-bbbbbbbbbbbbbbbbbbbbbb +prompt $ │prompt $ │prompt $ █ diff --git a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_left__move_focus_left_to_the_most_recently_used_pane.snap b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_left__move_focus_left_to_the_most_recently_used_pane.snap new file mode 100644 index 00000000..b175a531 --- /dev/null +++ b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_left__move_focus_left_to_the_most_recently_used_pane.snap @@ -0,0 +1,25 @@ +--- +source: src/tests/integration/move_focus_left.rs +expression: snapshot_before_quit + +--- +line17-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line1-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line2-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +a │line3-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line18-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line4-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line5-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +a │line6-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line19-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line7-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line8-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +a │line9-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +prompt $ │line10-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +────────────────────────────────────────────────────────────┤line11-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line12-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line13-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line19-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line14-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +prompt $ │line15-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +────────────────────────────────────────────────────────────┤line16-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line19-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line19-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +prompt $ █ │prompt $ diff --git a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_right__move_focus_right_to_the_most_recently_used_pane.snap b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_right__move_focus_right_to_the_most_recently_used_pane.snap new file mode 100644 index 00000000..312b8c04 --- /dev/null +++ b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_right__move_focus_right_to_the_most_recently_used_pane.snap @@ -0,0 +1,25 @@ +--- +source: src/tests/integration/move_focus_right.rs +expression: snapshot_before_quit + +--- +a │line11-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line14-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line12-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line13-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +a │line14-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line15-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line15-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line16-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +a │line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line16-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line19-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +a │prompt $ +line17-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa├──────────────────────────────────────────────────────────── +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +a │line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +line18-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line19-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│prompt $ +a ├──────────────────────────────────────────────────────────── +line19-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line17-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line18-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +a │line19-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +prompt $ │prompt $ █ diff --git a/src/tests/integration/snapshots/zellij__tests__integration__move_focus_up__move_focus_up_to_the_most_recently_used_pane.snap b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_up__move_focus_up_to_the_most_recently_used_pane.snap new file mode 100644 index 00000000..188bc9c4 --- /dev/null +++ b/src/tests/integration/snapshots/zellij__tests__integration__move_focus_up__move_focus_up_to_the_most_recently_used_pane.snap @@ -0,0 +1,25 @@ +--- +source: src/tests/integration/move_focus_up.rs +expression: snapshot_before_quit + +--- +line17-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line11-bbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line16-bbbbbbbbbbbbbbbbbbbbbbb│line12-bbbbbbbbbbbbbbbbbbbbbb +a │bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line13-bbbbbbbbbbbbbbbbbbbbbb +line18-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line17-bbbbbbbbbbbbbbbbbbbbbbb│line14-bbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line15-bbbbbbbbbbbbbbbbbbbbbb +a │line18-bbbbbbbbbbbbbbbbbbbbbbb│line16-bbbbbbbbbbbbbbbbbbbbbb +line19-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line17-bbbbbbbbbbbbbbbbbbbbbb +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa│line19-bbbbbbbbbbbbbbbbbbbbbbb│line18-bbbbbbbbbbbbbbbbbbbbbb +a │bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│line19-bbbbbbbbbbbbbbbbbbbbbb +prompt $ │prompt $ │prompt $ █ +────────────────────────────────────────────────────────────┴──────────────────────────────┴───────────────────────────── +line12-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line13-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line14-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line15-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line16-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line17-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line18-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +line19-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +prompt $ From e877c75ec16c14e1c1022c40ec6f5078c3106de2 Mon Sep 17 00:00:00 2001 From: Brooks Rady Date: Fri, 23 Apr 2021 04:06:14 +0100 Subject: [PATCH 07/13] fix(ui): resolve ambiguous plane movements by their activity history --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1c693ec..8ddaf5fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * Allow scrolling by full pages (https://github.com/zellij-org/zellij/pull/298) * Reduce crate size by 4.8MB using `cargo diet`, to 77kB (https://github.com/zellij-org/zellij/pull/293) * Draw UI properly when instantiated as the default terminal command (https://github.com/zellij-org/zellij/pull/323) +* Resolve ambigous pane movements by their activity history (https://github.com/zellij-org/zellij/pull/294) ## [0.5.0] - 2021-04-20 Beta release with all the things From 6ee31c84d784ba7b05ec67329e7581ef3411bc32 Mon Sep 17 00:00:00 2001 From: Brooks Rady Date: Fri, 23 Apr 2021 04:07:52 +0100 Subject: [PATCH 08/13] fix(ui): resolve ambiguous pane movements by their activity history (For those who witnessed this string of typos, I greatly apologize) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ddaf5fa..09b80a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * Allow scrolling by full pages (https://github.com/zellij-org/zellij/pull/298) * Reduce crate size by 4.8MB using `cargo diet`, to 77kB (https://github.com/zellij-org/zellij/pull/293) * Draw UI properly when instantiated as the default terminal command (https://github.com/zellij-org/zellij/pull/323) -* Resolve ambigous pane movements by their activity history (https://github.com/zellij-org/zellij/pull/294) +* Resolve ambiguous pane movements by their activity history (https://github.com/zellij-org/zellij/pull/294) ## [0.5.0] - 2021-04-20 Beta release with all the things From ce76efa096e7a25186c596d854f7ce358f2f4850 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Fri, 23 Apr 2021 10:43:45 +0200 Subject: [PATCH 09/13] chore(ci): remove release.yml --- .github/workflows/release.yml | 99 ----------------------------------- 1 file changed, 99 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 012d17d3..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: Packaging - -on: - push: - tags: - - 'v*.*.*' - -jobs: - publish: - name: Publish on ${{ matrix.os }} for ${{ matrix.target }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - target: - - x86_64-unknown-linux-gnu - - x86_64-unknown-linux-musl - - x86_64-apple-darwin - - include: - - os: ubuntu-18.04 - target: x86_64-unknown-linux-gnu - client_artifact_name: target/x86_64-unknown-linux-gnu/release/mosaic - client_release_name: mosaic-x86_64-unknown-linux-gnu - strip: true - - - os: ubuntu-18.04 - target: x86_64-unknown-linux-musl - client_artifact_name: target/x86_64-unknown-linux-musl/release/mosaic - client_release_name: mosaic-x86_64-unknown-linux-musl - strip: true - - - os: macos-latest - target: x86_64-apple-darwin - client_artifact_name: target/x86_64-apple-darwin/release/mosaic - client_release_name: mosaic-x86_64-macos-darwin - strip: true - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.target }} - override: true - - - name: Install musl - if: matrix.target == 'x86_64-unknown-linux-musl' - run: | - sudo apt update - sudo apt install musl-tools -y - - - name: cargo build - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --locked --target=${{ matrix.target }} - - - - name: Compress client - uses: svenstaro/upx-action@v2 - with: - file: ${{ matrix.client_artifact_name }} - args: --lzma - strip: ${{ matrix.strip }} - - - # TODO? - # - name: Get CHANGELOG.md entry - # id: changelog_reader - # uses: mindsers/changelog-reader-action@v1.2.0 - # with: - # path: ./CHANGELOG.md - - - name: Upload client binaries to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ matrix.client_artifact_name }} - asset_name: ${{ matrix.client_release_name }} - tag: ${{ github.ref }} - - deb-build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Deb Build - uses: ebbflow-io/cargo-deb-amd64-ubuntu@1.0 - - - name: Upload deb to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: target/x86_64-unknown-linux-musl/debian/mosaic* - asset_name: mosaic-amd64.deb - tag: ${{ github.ref }} - file_glob: true From 2a969cacd05cf90aadb0290745deda8b01ff5d06 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Fri, 23 Apr 2021 11:51:57 +0200 Subject: [PATCH 10/13] docs(changelog): update version --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09b80a5f..460861df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] + +## [0.5.1] - 2021-04-23 * Change config to flag (https://github.com/zellij-org/zellij/pull/300) * Add ZELLIJ environment variable on startup (https://github.com/zellij-org/zellij/pull/305) * Terminal fix: do not clear line if it's not there (https://github.com/zellij-org/zellij/pull/289) From 20a6a8e844c6b0e1063e7d82d0107013e04e9e44 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Fri, 23 Apr 2021 11:59:35 +0200 Subject: [PATCH 11/13] chore(version): boost development version to 0.6.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b6ece4a2..5fc7175c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2184,7 +2184,7 @@ dependencies = [ [[package]] name = "zellij" -version = "0.5.1" +version = "0.6.0" dependencies = [ "ansi_term 0.12.1", "async-std", diff --git a/Cargo.toml b/Cargo.toml index 7c811ae5..df330008 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zellij" -version = "0.5.1" +version = "0.6.0" authors = ["Aram Drevekenin "] edition = "2018" description = "A terminal workspace with batteries included" From 7bf39e685810aa9007807f7f031293c4e52e0623 Mon Sep 17 00:00:00 2001 From: Jan Philipp Hafer Date: Fri, 23 Apr 2021 15:56:25 +0200 Subject: [PATCH 12/13] fix(keybinding): fix tab mode dont exit on simple 'q' press --- src/common/input/keybinds.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/input/keybinds.rs b/src/common/input/keybinds.rs index 8e04c44a..ee039f83 100644 --- a/src/common/input/keybinds.rs +++ b/src/common/input/keybinds.rs @@ -295,7 +295,6 @@ impl Keybinds { Action::TabNameInput(vec![0]), ], ); - defaults.insert(Key::Char('q'), vec![Action::Quit]); defaults.insert( Key::Ctrl('g'), vec![Action::SwitchToMode(InputMode::Normal)], From 76534425101953f231e4bdf40ad44e6687222704 Mon Sep 17 00:00:00 2001 From: a-kenji Date: Fri, 23 Apr 2021 17:13:35 +0200 Subject: [PATCH 13/13] Update Changelog #342 * fix tab mode #342 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 460861df..ed90c8a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] +* Doesn't quit anymore on single `q` press while in tab mode (https://github.com/zellij-org/zellij/pull/342) ## [0.5.1] - 2021-04-23 * Change config to flag (https://github.com/zellij-org/zellij/pull/300)