aboutsummaryrefslogtreecommitdiff
path: root/src/server/render_stream.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/render_stream.rs')
-rw-r--r--src/server/render_stream.rs29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/server/render_stream.rs b/src/server/render_stream.rs
index d21dea56..facebd2c 100644
--- a/src/server/render_stream.rs
+++ b/src/server/render_stream.rs
@@ -290,15 +290,17 @@ pub(crate) fn render_virtual_with_runtime_registry(
resize_panes: bool,
cell_size: crate::kitty_graphics::HostCellSize,
) -> (ratatui::buffer::Buffer, Option<CursorState>) {
+ let popup_visible = app_state.popup_pane.is_some();
let pre_compute_suppresses_focused_terminal_cursor =
- focused_terminal_suppresses_host_cursor(app_state, terminal_runtimes);
+ !popup_visible && focused_terminal_suppresses_host_cursor(app_state, terminal_runtimes);
if resize_panes {
crate::ui::compute_view_with_cell_size(app_state, terminal_runtimes, area, cell_size);
} else {
crate::ui::compute_view_without_resizing_panes(app_state, terminal_runtimes, area);
}
let suppress_focused_terminal_cursor = pre_compute_suppresses_focused_terminal_cursor
- || focused_terminal_suppresses_host_cursor(app_state, terminal_runtimes);
+ || (!popup_visible
+ && focused_terminal_suppresses_host_cursor(app_state, terminal_runtimes));
let backend = CursorTrackingBackend::new(area.width, area.height);
let mut terminal = ratatui::Terminal::new(backend).expect("TestBackend::new should never fail");
@@ -310,7 +312,9 @@ pub(crate) fn render_virtual_with_runtime_registry(
.expect("render to TestBackend should never fail");
let buffer = terminal.backend().buffer().clone();
- let cursor = if suppress_focused_terminal_cursor {
+ let cursor = if popup_visible {
+ popup_terminal_cursor(app_state, terminal_runtimes)
+ } else if suppress_focused_terminal_cursor {
None
} else {
focused_terminal_cursor(app_state, terminal_runtimes).or_else(|| {
@@ -323,6 +327,25 @@ pub(crate) fn render_virtual_with_runtime_registry(
(buffer, cursor)
}
+fn popup_terminal_cursor(
+ app_state: &AppState,
+ terminal_runtimes: &TerminalRuntimeRegistry,
+) -> Option<CursorState> {
+ let popup = app_state.popup_pane.as_ref()?;
+ let runtime = terminal_runtimes.get(&popup.terminal_id)?;
+ if runtime.synchronized_output_active() {
+ return None;
+ }
+ let (_, inner) = crate::ui::popup_pane_rects(app_state, app_state.view.terminal_area)?;
+ let cursor = runtime.cursor_state(inner, true)?;
+ Some(CursorState {
+ x: cursor.x,
+ y: cursor.y,
+ visible: cursor.visible && !crate::ui::pane_is_scrolled_back(runtime),
+ shape: cursor.shape,
+ })
+}
+
/// Renders one server-owned terminal directly for `terminal attach` clients.
pub(crate) fn render_terminal_virtual(
runtime: &crate::terminal::TerminalRuntime,