aboutsummaryrefslogtreecommitdiff
path: root/src/pane/terminal.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-07 00:07:24 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-07 16:29:44 +0300
commit3c2b46d24aa6c8011a1e198143752f2aa414d585 (patch)
treea52280bccc824ca656f8bc986a756f30901974e4 /src/pane/terminal.rs
parent5d7e56737ef30d9de5802b0684a9428c40131dda (diff)
feat: add native windows beta support
Diffstat (limited to 'src/pane/terminal.rs')
-rw-r--r--src/pane/terminal.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs
index cf8506ba..9bfcf57f 100644
--- a/src/pane/terminal.rs
+++ b/src/pane/terminal.rs
@@ -23,7 +23,7 @@ use super::{
osc::{
contains_scrollback_clear_sequence, current_transient_default_color_owner,
maybe_filter_primary_screen_scrollback_clear, restore_host_terminal_theme_if_needed,
- write_host_terminal_theme, DefaultColorEvent, DefaultColorEventTracker,
+ write_host_terminal_theme, CwdOscTracker, DefaultColorEvent, DefaultColorEventTracker,
DefaultColorOscTracker, DefaultColorQuery, DefaultColorTrackedEvent, Osc52Forwarder,
},
xtgettcap::{XtgettcapQueryTracker, XtgettcapResponse},
@@ -101,6 +101,7 @@ pub(crate) struct ProcessBytesResult {
pub request_render: bool,
pub render_delay: Option<Duration>,
pub clipboard_writes: Vec<Vec<u8>>,
+ pub reported_cwd: Option<std::path::PathBuf>,
pub terminal_responses: Vec<Bytes>,
}
@@ -123,6 +124,7 @@ pub(crate) struct GhosttyPaneCore {
pub child_default_foreground_changed: bool,
pub child_default_background_changed: bool,
pub osc52_forwarder: Osc52Forwarder,
+ pub cwd_osc_tracker: CwdOscTracker,
pub xtgettcap_query_tracker: XtgettcapQueryTracker,
}
@@ -264,6 +266,7 @@ impl PaneTerminal {
self.ghostty.keyboard_protocol().unwrap_or(fallback)
}
+ #[cfg(unix)]
pub fn kitty_keyboard_state_ansi(&self) -> Option<String> {
self.ghostty
.kitty_keyboard_state_ansi()
@@ -352,6 +355,7 @@ impl GhosttyPaneTerminal {
child_default_foreground_changed: false,
child_default_background_changed: false,
osc52_forwarder: Osc52Forwarder::default(),
+ cwd_osc_tracker: CwdOscTracker::default(),
xtgettcap_query_tracker: XtgettcapQueryTracker::default(),
}),
key_encoder: Mutex::new(key_encoder),
@@ -419,6 +423,7 @@ impl GhosttyPaneTerminal {
request_render: false,
render_delay: None,
clipboard_writes: Vec::new(),
+ reported_cwd: None,
terminal_responses: Vec::new(),
};
};
@@ -436,6 +441,8 @@ impl GhosttyPaneTerminal {
core.osc52_forwarder.observe(bytes);
let clipboard_writes = core.osc52_forwarder.drain_pending();
+ core.cwd_osc_tracker.observe(bytes);
+ let reported_cwd = core.cwd_osc_tracker.drain_latest();
let alternate_screen = core
.terminal
@@ -507,6 +514,7 @@ impl GhosttyPaneTerminal {
request_render,
render_delay,
clipboard_writes,
+ reported_cwd,
terminal_responses,
}
}
@@ -576,6 +584,7 @@ impl GhosttyPaneTerminal {
}
}
+ #[cfg(unix)]
pub fn seed_handoff_input_state(&self, input_state: InputState) {
let Ok(mut core) = self.core.lock() else {
return;
@@ -647,6 +656,7 @@ impl GhosttyPaneTerminal {
}
}
+ #[cfg(unix)]
pub fn seed_keyboard_protocol_flags(&self, flags: u16) {
if flags == 0 {
return;
@@ -654,6 +664,7 @@ impl GhosttyPaneTerminal {
self.seed_keyboard_protocol_ansi(&format!("\x1b[>{flags}u"));
}
+ #[cfg(unix)]
pub fn seed_keyboard_protocol_ansi(&self, ansi: &str) {
if ansi.is_empty() {
return;
@@ -785,6 +796,7 @@ impl GhosttyPaneTerminal {
))
}
+ #[cfg(unix)]
pub fn kitty_keyboard_state_ansi(&self) -> Option<String> {
let core = self.core.lock().ok()?;
core.kitty_keyboard.replay_ansi()
@@ -2144,6 +2156,7 @@ mod tests {
assert_eq!(encoded, b"\x1bOA");
}
+ #[cfg(unix)]
#[test]
fn ghostty_seed_handoff_input_state_restores_input_modes() {
let (tx, _rx) = mpsc::channel(4);
@@ -2254,6 +2267,7 @@ mod tests {
assert_eq!(encoded, b"\x1b[13;2u");
}
+ #[cfg(unix)]
#[test]
fn ghostty_seed_keyboard_protocol_flags_restores_shift_enter_encoding() {
let (tx, _rx) = mpsc::channel(4);
@@ -2271,6 +2285,7 @@ mod tests {
assert_eq!(encoded, b"\x1b[13;2u");
}
+ #[cfg(unix)]
#[test]
fn ghostty_keyboard_protocol_state_replays_nested_stack() {
let (tx, _rx) = mpsc::channel(4);