diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-17 01:41:17 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-17 01:41:17 +0300 |
| commit | 3ecacfddae86d603bfd0d1a0c01602b1d34b1df3 (patch) | |
| tree | 277941c065295af2bd161c6be6fd7a2555c1f060 /src/ui | |
| parent | a36da363f14639085bec91d7a378d6c2eeaa6c58 (diff) | |
feat: add direct terminal attach stream
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/panes.rs | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/src/ui/panes.rs b/src/ui/panes.rs index c90183ea..e149362c 100644 --- a/src/ui/panes.rs +++ b/src/ui/panes.rs @@ -59,13 +59,15 @@ fn runtime_for_tab_pane<'a>( app: &'a AppState, tab: &'a crate::workspace::Tab, pane_id: crate::layout::PaneId, -) -> Option<&'a TerminalRuntime> { +) -> Option<(&'a crate::terminal::TerminalId, &'a TerminalRuntime)> { + let terminal_id = tab.terminal_id(pane_id)?; #[cfg(test)] if let Some(runtime) = tab.runtimes.get(&pane_id) { - return Some(runtime); + return Some((terminal_id, runtime)); } - let terminal_id = tab.terminal_id(pane_id)?; - app.terminal_runtimes.get(terminal_id) + app.terminal_runtimes + .get(terminal_id) + .map(|runtime| (terminal_id, runtime)) } fn stable_scrollbar_gutter(rt: &TerminalRuntime, pane_inner: Rect) -> (Rect, Option<Rect>) { @@ -98,14 +100,16 @@ pub(super) fn resize_tab_panes( if tab.zoomed { let focused_id = tab.layout.focused(); - if let Some(rt) = runtime_for_tab_pane(app, tab, focused_id) { + if let Some((terminal_id, rt)) = runtime_for_tab_pane(app, tab, focused_id) { let inner_rect = stable_terminal_inner_rect(area); - rt.resize( - inner_rect.height, - inner_rect.width, - cell_size.width_px, - cell_size.height_px, - ); + if !app.direct_attach_resize_locks.contains(terminal_id) { + rt.resize( + inner_rect.height, + inner_rect.width, + cell_size.width_px, + cell_size.height_px, + ); + } } return; } @@ -117,14 +121,16 @@ pub(super) fn resize_tab_panes( area }; - if let Some(rt) = runtime_for_tab_pane(app, tab, info.id) { + if let Some((terminal_id, rt)) = runtime_for_tab_pane(app, tab, info.id) { let inner_rect = stable_terminal_inner_rect(pane_inner); - rt.resize( - inner_rect.height, - inner_rect.width, - cell_size.width_px, - cell_size.height_px, - ); + if !app.direct_attach_resize_locks.contains(terminal_id) { + rt.resize( + inner_rect.height, + inner_rect.width, + cell_size.width_px, + cell_size.height_px, + ); + } } } } @@ -152,7 +158,11 @@ pub(super) fn compute_pane_infos( let mut scrollbar_rect = None; if let Some(rt) = app.runtime_for_pane_in_workspace(ws_idx, focused_id) { (inner_rect, scrollbar_rect) = stable_scrollbar_gutter(rt, area); - if resize_panes { + if resize_panes + && ws.terminal_id(focused_id).is_some_and(|terminal_id| { + !app.direct_attach_resize_locks.contains(terminal_id) + }) + { rt.resize( inner_rect.height, inner_rect.width, @@ -191,7 +201,11 @@ pub(super) fn compute_pane_infos( let mut scrollbar_rect = None; if let Some(rt) = app.runtime_for_pane_in_workspace(ws_idx, info.id) { (inner_rect, scrollbar_rect) = stable_scrollbar_gutter(rt, pane_inner); - if resize_panes { + if resize_panes + && ws.terminal_id(info.id).is_some_and(|terminal_id| { + !app.direct_attach_resize_locks.contains(terminal_id) + }) + { rt.resize( inner_rect.height, inner_rect.width, |
