fix: close remaining gaps found by the completeness audit

Addresses the partial ports listed in
docs/rewrite/notes/review-completeness-codex.md (details in
docs/rewrite/notes/gaps-X2.md):
- Flatpak: the exit watcher no longer consumes the host command; a
  shared FlatpakSignalHandle lets closing a surface still SIGHUP the
  host process group.
- Child environment is byte-preserving end to end (ghostty_os::EnvMap
  of OsStrings) and Snap paths are filtered like filterSnapPaths.
- argv handling no longer panics on non-UTF-8 arguments.
- URI percent-decoding keeps raw bytes; OSC 7 pwd is passed through
  without lossy conversion.
- Keybinding comparison/hashing uses full Unicode case folding from a
  table generated from CaseFolding.txt (Unicode 17.0.0).
- Link regexes set Oniguruma's whole-search retry limit through the new
  minimal ghostty-onig crate (one SAFETY-commented FFI call).
- OSC 9 NUL-capacity check ordering matches Zig.
- Wayland registry binds/clears globals advertised after startup.
- Custom shaders may pass sampler2D to helper functions (naga adapter).
- +list-themes preview renders OSC 8 links, styled underlines and
  follows color-scheme reports.

Also includes the inspector's integration edits in shared files
(renderer state hook, termio VT recording, core/apprt-gtk wiring), X1's
config/input/cli additions for completion generation, and a fix for a
race in the termio backpressure test (it wrote before `stty raw`
applied, so the cooked line discipline dropped bytes past MAX_CANON).

Test Plan:
- cargo test --workspace
- cargo clippy --workspace --all-targets -- -D warnings
This commit is contained in:
ddidderr committed 2026-10-12 04:39:24 +02:00
1 parent 90ad602969
commit f4c020101c
61 files changed
+4210 -298

No files matched your search

+24 -3
View File
@@ -34,6 +34,7 @@ use ghostty_config::types_b::{ClipboardAccess, GraphemeWidthMethod, OSCColorRepo
use ghostty_datastruct::blocking_queue::Timeout;
use ghostty_renderer::message::Message as RendererMessage;
use ghostty_renderer::size::Size;
use ghostty_renderer::state::InspectorHook;
use ghostty_terminal::kitty::graphics_storage::TerminalInfo;
use ghostty_terminal::point::{Coordinate, Point};
use ghostty_terminal::screen::Scroll;
@@ -221,8 +222,9 @@ impl Output {
// the lock to grab our read data.
let outbox = {
let mut term = self.state.lock_terminal();
let inspector = term.state().inspector.clone();
let mut inner = self.inner();
self.process_output_locked(&mut term, &mut inner, buf);
self.process_output_locked(&mut term, &mut inner, buf, inspector.as_deref());
// If our stream handling caused messages to be sent to the
// mailbox thread, then we need to wake it up so that it
@@ -241,7 +243,13 @@ impl Output {
}
/// Process output from the pty but the lock is already held.
fn process_output_locked(&self, term: &mut Terminal, inner: &mut OutputInner, buf: &[u8]) {
fn process_output_locked(
&self,
term: &mut Terminal,
inner: &mut OutputInner,
buf: &[u8],
inspector: Option<&dyn InspectorHook>,
) {
// Schedule a render. We can call this first because we have the lock.
inner.stream.state.queue_render();
@@ -260,7 +268,20 @@ impl Output {
.push(RendererMessage::ResetCursorBlink, Timeout::Instant);
}
if let Err(err) = inner.stream.process(term, buf) {
// If we have an inspector, we enter SLOW MODE because we need to
// process a byte at a time alternating between the inspector handler
// and the termio handler. This is very slow compared to our
// optimizations below but at least users only pay for it if they're
// using the inspector.
if let Some(insp) = inspector {
for &byte in buf {
insp.record_pty_read(term, &[byte]);
if let Err(err) = inner.stream.process_byte(term, byte) {
log::error!("error processing terminal data: {err:?}");
}
}
} else if let Err(err) = inner.stream.process(term, buf) {
log::error!("error processing terminal data: {err:?}");
}
}