diff options
Diffstat (limited to 'src/server/render_stream.rs')
| -rw-r--r-- | src/server/render_stream.rs | 84 |
1 files changed, 2 insertions, 82 deletions
diff --git a/src/server/render_stream.rs b/src/server/render_stream.rs index facebd2c..8858bb6b 100644 --- a/src/server/render_stream.rs +++ b/src/server/render_stream.rs @@ -384,94 +384,14 @@ pub(crate) fn visible_hyperlinks( app_state: &AppState, terminal_runtimes: &TerminalRuntimeRegistry, ) -> Vec<((u16, u16), String, String)> { - let Some(ws_idx) = app_state.active else { - return Vec::new(); - }; - if app_state.workspaces.get(ws_idx).is_none() { - return Vec::new(); - } - - let mut links = Vec::new(); - for info in &app_state.view.pane_infos { - if let Some(runtime) = - app_state.runtime_for_pane_in_workspace(terminal_runtimes, ws_idx, info.id) - { - links.extend(runtime.visible_hyperlinks(info.inner_rect)); - } - } - links + crate::ui::tab_surface_hyperlinks(app_state, terminal_runtimes, app_state.view.tab_surface()) } pub(crate) fn focused_terminal_cursor( app_state: &AppState, terminal_runtimes: &TerminalRuntimeRegistry, ) -> Option<CursorState> { - if app_state.mode != Mode::Terminal { - return None; - } - - let ws_idx = app_state.active?; - let info = app_state - .view - .pane_infos - .iter() - .find(|info| info.is_focused)?; - if !app_state.pane_exposes_host_cursor(ws_idx, info.id) { - return None; - } - let rt = app_state.runtime_for_pane_in_workspace(terminal_runtimes, ws_idx, info.id)?; - if rt.synchronized_output_active() { - return None; - } - let scrolled_back = crate::ui::pane_is_scrolled_back(rt); - // Determine whether the IME-anchor reveal applies to this focused pane. - // The master switch must be on, and either no agent filter is configured - // (apply to any pane) or the focused pane's detected agent matches the - // allow-list. A configured list with no valid entries reveals nothing. - let reveal = app_state.reveal_hidden_cursor_for_cjk_ime - && (!app_state.cjk_ime_agent_filter_configured || { - let detected = app_state - .workspaces - .get(ws_idx) - .and_then(|ws| ws.terminal_id(info.id)) - .and_then(|tid| app_state.terminals.get(tid)) - .and_then(|t| t.detected_agent); - detected.is_some_and(|agent| app_state.cjk_ime_agents.contains(&agent)) - }); - - if let Some(cursor) = rt.cursor_state(info.inner_rect, true) { - // When the reveal applies, expose the cursor anchor regardless of the - // pane's `?25l` request so macOS IMEs keep tracking the candidate - // window when TUIs paint their own cursor. Scrollback suppression - // still applies. - let visible = if reveal { - !scrolled_back - } else { - cursor.visible && !scrolled_back - }; - Some(CursorState { - x: cursor.x, - y: cursor.y, - visible, - shape: if reveal && visible { - app_state.cjk_ime_cursor_shape - } else { - cursor.shape - }, - }) - } else if reveal && !scrolled_back { - // cursor_state() returned None — the viewport has no cursor position - // (can happen with complex TUIs). Fall back to the pane's top-left so - // the outer terminal still exposes a cursor anchor for IME tracking. - Some(CursorState { - x: info.inner_rect.x, - y: info.inner_rect.y, - visible: true, - shape: app_state.cjk_ime_cursor_shape, - }) - } else { - None - } + crate::ui::tab_surface_cursor(app_state, terminal_runtimes, app_state.view.tab_surface()) } fn focused_terminal_owns_host_cursor( |
