diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-05 21:59:10 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-05 22:06:02 +0300 |
| commit | 556b16b2df7ea2c3e9b8ad13db4ad7370c1ad838 (patch) | |
| tree | 0a6f61701f2c8992c6cd1ee6d61171ef92a92533 /src/workspace.rs | |
| parent | ae3c88ab8c64931740d89623f688f7d3f408da5e (diff) | |
feat: add pane navigation controls
refs #421
refs #330
related discussions:
https://github.com/ogulcancelik/herdr/discussions/422
https://github.com/ogulcancelik/herdr/discussions/438
https://github.com/ogulcancelik/herdr/discussions/442
Diffstat (limited to 'src/workspace.rs')
| -rw-r--r-- | src/workspace.rs | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/src/workspace.rs b/src/workspace.rs index 8a660b02..b01b5891 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -428,6 +428,36 @@ impl Workspace { self.split_pane_with_runtime( pane_id, direction, + None, + rows, + cols, + cwd, + scrollback_limit_bytes, + host_terminal_theme, + shell_config, + focus_new_pane, + None, + ) + } + + #[allow(clippy::too_many_arguments)] + pub fn split_pane_with_ratio( + &mut self, + pane_id: PaneId, + direction: Direction, + ratio: f32, + rows: u16, + cols: u16, + cwd: Option<PathBuf>, + scrollback_limit_bytes: usize, + host_terminal_theme: crate::terminal_theme::TerminalTheme, + shell_config: crate::pane::PaneShellConfig<'_>, + focus_new_pane: bool, + ) -> Option<std::io::Result<(usize, crate::workspace::tab::NewPane)>> { + self.split_pane_with_runtime( + pane_id, + direction, + Some(ratio), rows, cols, cwd, @@ -455,6 +485,7 @@ impl Workspace { self.split_pane_with_runtime( pane_id, direction, + None, rows, cols, cwd, @@ -471,6 +502,7 @@ impl Workspace { &mut self, pane_id: PaneId, direction: Direction, + ratio: Option<f32>, rows: u16, cols: u16, cwd: Option<PathBuf>, @@ -495,15 +527,27 @@ impl Workspace { host_terminal_theme, ) } else { - tab.split_focused( - direction, - rows, - cols, - cwd, - scrollback_limit_bytes, - host_terminal_theme, - shell_config, - ) + match ratio { + Some(ratio) => tab.split_focused_with_ratio( + direction, + ratio, + rows, + cols, + cwd, + scrollback_limit_bytes, + host_terminal_theme, + shell_config, + ), + None => tab.split_focused( + direction, + rows, + cols, + cwd, + scrollback_limit_bytes, + host_terminal_theme, + shell_config, + ), + } } { Ok(new_pane) => new_pane, Err(err) => { |
