aboutsummaryrefslogtreecommitdiff
path: root/src/pane
diff options
context:
space:
mode:
authorakbash <akbash@herdr.dev>2026-08-08 02:15:56 +0300
committerGitHub <noreply@github.com>2026-08-08 02:15:56 +0300
commit6f311498aeeb27c0973781961ef94e8d0016ed17 (patch)
tree7aee2363b21b830fdbcf8dca9a7eda57a3393fb5 /src/pane
parent50ddc06f00ec69ede35fd5488a260dec2b74e98a (diff)
fix: forward pane terminal bells (#2498)
refs #2453 Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com>
Diffstat (limited to 'src/pane')
-rw-r--r--src/pane/terminal.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs
index 67b57153..8de84af3 100644
--- a/src/pane/terminal.rs
+++ b/src/pane/terminal.rs
@@ -145,6 +145,7 @@ impl InputState {
pub(crate) struct ProcessBytesResult {
pub request_render: bool,
pub render_delay: Option<Duration>,
+ pub terminal_bells: u16,
pub clipboard_writes: Vec<Vec<u8>>,
pub reported_cwd: Option<std::path::PathBuf>,
pub terminal_responses: Vec<Bytes>,
@@ -1201,6 +1202,7 @@ impl GhosttyPaneTerminal {
return ProcessBytesResult {
request_render: false,
render_delay: None,
+ terminal_bells: 0,
clipboard_writes: Vec::new(),
reported_cwd: None,
terminal_responses: Vec::new(),
@@ -1209,7 +1211,8 @@ impl GhosttyPaneTerminal {
let _ = core.terminal.take_pwd_changes();
// Restored history may have exercised terminal callbacks before this live PTY write.
- // Those writes must not be delivered as live pane output.
+ // Those effects must not be delivered as live pane output.
+ let _ = core.terminal.take_bell_count();
let _ = core.terminal.take_clipboard_writes();
let default_color_observation = core.default_color_tracker.observe(bytes);
if shell_pid > 0 && default_color_observation {
@@ -1276,6 +1279,7 @@ impl GhosttyPaneTerminal {
xtgettcap_responses,
&mut terminal_responses,
);
+ let terminal_bells = core.terminal.take_bell_count();
let clipboard_writes = core.terminal.take_clipboard_writes();
let reported_cwd = core
.terminal
@@ -1332,6 +1336,7 @@ impl GhosttyPaneTerminal {
ProcessBytesResult {
request_render,
render_delay,
+ terminal_bells,
clipboard_writes,
reported_cwd,
terminal_responses,
@@ -3735,6 +3740,21 @@ mod tests {
}
#[test]
+ fn process_pty_bytes_surfaces_live_bells_only() {
+ let (tx, _rx) = mpsc::channel(4);
+ let terminal = crate::ghostty::Terminal::new(80, 24, 100).unwrap();
+ let pane = GhosttyPaneTerminal::new(terminal, tx.clone()).unwrap();
+ let pane_id = PaneId::from_raw(1);
+
+ pane.seed_history_ansi("stale\x07");
+ let result = pane.process_pty_bytes(pane_id, 0, b"\x07\x1b]0;title\x07\x07", &tx);
+
+ assert_eq!(result.terminal_bells, 2);
+ let drained = pane.process_pty_bytes(pane_id, 0, b"live output", &tx);
+ assert_eq!(drained.terminal_bells, 0);
+ }
+
+ #[test]
fn process_pty_bytes_surfaces_clipboard_writes_without_other_results() {
let (tx, _rx) = mpsc::channel(4);
let terminal = crate::ghostty::Terminal::new(80, 24, 100).unwrap();
@@ -3749,6 +3769,7 @@ mod tests {
assert!(result.request_render);
assert_eq!(result.render_delay, None);
+ assert_eq!(result.terminal_bells, 0);
assert_eq!(result.clipboard_writes, vec![b"clipboard".to_vec()]);
assert_eq!(result.reported_cwd, None);
assert!(result.terminal_responses.is_empty());