summaryrefslogtreecommitdiff
path: root/src/termio/Thread.zig
AgeCommit message (Collapse)Author
2025-07-18termio: simplify logging to remove undefined accessMitchell Hashimoto
2025-06-30various cleanups around scroll timersMitchell Hashimoto
2025-06-30surface: add timer-based scrolling during selectionmoni-dz
2025-06-30termio: add selection scrolling callbackmoni-dz
2025-06-27Move child exit handling logic to apprt threadMitchell Hashimoto
Fixes #7500 Supersedes #7582 This commit moves the child exit handling logic from the IO thead to the apprt thread. The IO thread now only sends a `child_exited` message to the apprt thread with metadata about the exit conditions (exit code, runtime). From there, the apprt thread can handle the exit situation however is necessary. This commit doesn't change the behavior but it does fix the issue #7500. The behavior is: exit immediately, show abnormal exit message, wait for user input, etc. This also gets us closer to #7649.
2025-06-22`input` configuration to pass input as stdin on startupMitchell Hashimoto
This adds a new configuration `input` that allows passing either raw text or file contents as stdin when starting the terminal. The input is sent byte-for-byte to the terminal, so control characters such as `\n` will be interpreted by the shell and can be used to run programs in the context of the loaded shell. Example: `ghostty --input="hello, world\n"` will start the your default shell, run `echo hello, world`, and then show the prompt.
2025-06-20debug: properly set thread names on macOSQwerasd
2025-02-21Update libxev to use dynamic backend, support Linux configurabilityMitchell Hashimoto
Related to #3224 Previously, Ghostty used a static API for async event handling: io_uring on Linux, kqueue on macOS. This commit changes the backend to be dynamic on Linux so that epoll will be used if io_uring isn't available, or if the user explicitly chooses it. This introduces a new config `async-backend` (default "auto") which can be set by the user to change the async backend in use. This is a best-effort setting: if the user requests io_uring but it isn't available, Ghostty will fall back to something that is and that choice is up to us. Basic benchmarking both in libxev and Ghostty (vtebench) show no noticeable performance differences introducing the dynamic API, nor choosing epoll over io_uring.
2024-11-14termio: change resize message to use new size structMitchell Hashimoto
2024-11-07move datastructures to dedicated "datastruct" packageMitchell Hashimoto
2024-10-18fix: report correct screen pixel sizeTim Culverhouse
Mode 2048 and CSI 14 t are size report control sequences which contain the text area size in pixels. The text area is defined to be the extents of the grid (rows and columns). Ghostty calculates the available size for the text area by setting the available padding, and then filling as much of the remaining space as possible. However, if there are remainder pixels these are still reported as part of the text area size. Pass the cell_size geometry through so that we can always report the correct value: columns * cell width and rows * cell height.
2024-09-04termio: send initial focus reportsGregory Anders
When the focus reporting mode (1004) is enabled, send the current focus state. This allows applications to track their own focus state without first having to wait for a focus event (or query it by sending a DECSET followed by a DECRST). Ghostty's focus state is stored only in the renderer, where the termio thread cannot access it. We duplicate the focus state tracking in the Terminal struct with the addition of a new (1-bit) flag. We duplicate the state because the renderer uses the focus state for its own purposes (in particular, the Metal renderer uses the focus state to manage its DisplayLink), and synchronizing access to the shared terminal state is more cumbersome than simply tracking the focus state in the renderer in addition to the terminal.
2024-09-02crash: tag the thread typeMitchell Hashimoto
2024-09-02input: crash binding can configure which thread to crashMitchell Hashimoto
2024-09-01renderer/termio attach thread local state for crash captureMitchell Hashimoto
2024-08-07Implement the XTWINOPS (CSI t) control sequences that "make sense".Jeffrey C. Ollie
These sequences were implemented: CSI 14 t - report the text area size in pixels CSI 16 t - report the cell size in pixels CSI 18 t - report the text area size in cells CSI 21 t - report the window title These sequences were not implemented because they manuipulate the window state in ways that we do not want. CSI 1 t CSI 2 t CSI 3 ; x ; y t CSI 4 ; height ; width ; t CSI 5 t CSI 6 t CSI 7 t CSI 8 ; height ; width ; t CSI 9 ; 0 t CSI 9 ; 1 t CSI 9 ; 2 t CSI 9 ; 3 t CSI 10 ; 0 t CSI 10 ; 1 t CSI 10 ; 2 t CSI 24 t These sequences were not implemented because they do not make sense in a Wayland context: CSI 11 t CSI 13 t CSI 14 ; 2 t These sequences were not implemented because they provide information about the screen that is unnecessary. CSI 15 t CSI 19 t These sequences were not implemeted because Ghostty does not maintain an icon title for windows. CSI 20 t CSI 22 ; 0 t CSI 22 ; 1 t CSI 23 ; 0 t CSI 23 ; 1 t These sequences were not implemented because of the additional complexity of maintaining a stack of window titles. CSI 22 ; 2 t CSI 23 ; 2 t
2024-07-17terminal: implement in-band size reports (Mode 2048)Mitchell Hashimoto
https://gist.github.com/rockorager/e695fb2924d36b2bcf1fff4a3704bd83
2024-07-15termio: writer => mailboxMitchell Hashimoto
2024-07-14termio: more windows fixesMitchell Hashimoto
2024-07-14termio: writer abstractionMitchell Hashimoto
2024-07-14termio: Thread doesn't need to hold termio pointerMitchell Hashimoto
2024-07-13termio: wip but it buildsMitchell Hashimoto
2024-07-13termio: rename Exec to Termio throughoutMitchell Hashimoto
2024-03-22termio/exec: get compiler errors goneMitchell Hashimoto
2024-01-15termio: handle termio thread failure by showing a message in windowMitchell Hashimoto
Fixes #1301
2024-01-13remove tracy usage from all filesMitchell Hashimoto
2023-12-30Add exit code and runtime to abnormal exit error message.Jeffrey C. Ollie
2023-12-30termio/exec: use message to writer thread so we can output failed cmdMitchell Hashimoto
2023-10-24all threads are notified of inspector state, trigger renderMitchell Hashimoto
2023-10-12terminal: linefeed modeMitchell Hashimoto
2023-08-28renderer: do not render if synchronized output is onMitchell Hashimoto
2023-08-28termio: handle all the synchronized output setting, timerMitchell Hashimoto
2023-08-09scroll top, bot, page up, page down binding actionsMitchell Hashimoto
2023-07-06keybinding jump_to_prompt for semantic promptsMitchell Hashimoto
2023-03-19update config messages use pointers now to make messages small againMitchell Hashimoto
2023-03-19termio: use DerivedConfigMitchell Hashimoto
2023-03-08termio: coalesce resize eventsMitchell Hashimoto
On macOS, we were seeing resize events dropped by child processes if too many SIGWNCH events were generated.
2023-03-03clear_history binding, default Cmd+KMitchell Hashimoto
2023-02-25termio: use host-spawn for ptyMitchell Hashimoto
2023-02-06termio: reader thread is thread-safe for writing to writerMitchell Hashimoto
2023-02-04remove libuv from buildMitchell Hashimoto
2023-02-04termio: use libxev (with TODOs)Mitchell Hashimoto
2023-02-01renderer uses libxevMitchell Hashimoto
Still some bugs and TODOs, but it is workable.
2022-11-20do not block channel send while draining channelMitchell Hashimoto
2022-11-14padding needs to be sent to termioMitchell Hashimoto
2022-11-07name threads and add more tracingMitchell Hashimoto
2022-11-06clean up some resources better on errorMitchell Hashimoto
2022-11-05rename termio thread message structMitchell Hashimoto
2022-11-05allocate data for paste data if its too largeMitchell Hashimoto
2022-11-05Switch over to the IO thread. A messy commit!Mitchell Hashimoto