From 49ed4dc3fe2b547bf6508a855364ec53ec3fe76d Mon Sep 17 00:00:00 2001
From: Anas Limem <160512789+anaslimem@users.noreply.github.com>
Date: Mon, 30 Mar 2026 08:32:42 +0100
Subject: [PATCH] Hide cursor in embedded terminal when not focused (#52404)
## Context
Fixes #52063
This change hides the cursor in embedded terminal mode when not focused.
Embedded mode is used for read-only terminal output (like the Agent
panel). Showing a cursor in a read-only context when unfocused is
confusing, so we suppress it.
## How to Review
The change is in a single file:
`crates/terminal_view/src/terminal_view.rs:754-761`.
Focus on the `should_show_cursor()` method
Verify the logic correctly hides the cursor only when both conditions
are met (Embedded mode AND not focused).
## Self-Review Checklist
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments (N/A - no unsafe
code)
- [x] The content is consistent with the UI/UX checklist
- [x] Tests cover the new/changed behavior (behavior is minimal UI fix,
existing tests should cover)
- [x] Performance impact has been considered and is acceptable
(negligible)
Release Notes:
- Fixed cursor visibility issue in embedded terminal panels
---
crates/terminal_view/src/terminal_view.rs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs
index f3188f0f3ab4e7288d406fb43b0d3a416a76771f..98b37eee576d3c9a5b21def618133c1b9fe53e37 100644
--- a/crates/terminal_view/src/terminal_view.rs
+++ b/crates/terminal_view/src/terminal_view.rs
@@ -754,7 +754,14 @@ impl TerminalView {
}
pub fn should_show_cursor(&self, focused: bool, cx: &mut Context) -> bool {
- // Always show cursor when not focused or in special modes
+ // Hide cursor when in embedded mode and not focused (read-only output like Agent panel)
+ if let TerminalMode::Embedded { .. } = &self.mode {
+ if !focused {
+ return false;
+ }
+ }
+
+ // For Standalone mode: always show cursor when not focused or in special modes
if !focused
|| self
.terminal