This applies to --position, remember_window_position and positions from
sessions, which could otherwise place the window on a monitor that is no
longer connected.
When an on_quit watcher aborted a quit, the application quit request was
left as CONFIRMABLE_CLOSE_REQUESTED, so process_pending_closes() called
boss.quit() on every tick.
Add two new image formats, f=8 with one byte per pixel that is an index
into the terminal color palette and f=16 with a palette index followed by
an alpha byte. Indices 0-247 are the SGR 256 color table entries and
248-255 are special colors: default background, default foreground,
selection background and foreground, cursor, cursor text, URL color and
one reserved slot. Such images change color automatically when the
terminal colors change.
The images are uploaded as integer textures and drawn by a separate
shader program that looks up colors in the existing per window color
table uniform block, so a color scheme change costs nothing extra and
rendering of normal images is unaffected. Programs are switched only at
boundaries between runs of indexed and normal images in draw order. The
shader does bilinear filtering after the palette lookup since integer
textures cannot be filtered. Animation and frame composition are not
supported for these formats.
Closes#10666
Groups that are active until an event turns them off, such as those
using animation_toggle, now also move pointer events, while they are
active. The pointer map is recomputed only when the set of active such
groups changes, and pointer events are left alone once all of them have
been turned off.
Add a shader_event action that sends user:<name> events to the custom
shader pipeline, and an animation_toggle pipeline directive to turn
groups on and off with an event. User events occupy the bits above the
builtin events in a now 64 bit event mask, so firing them costs no more
than any other event and groups that are off are not drawn at all.
Fixes#10667
The glyph for a private use codepoint depends on the font, not the style.
Looking for a bold or italic font covering it tends to find an unrelated
text font that happens to cover it, for example Liberation Serif Italic for
the Nerd Font check mark U+f00c, which rendered as a thin line in the bold
italic title of the active tab.
Restrict the style-ignoring fallback lookup to the Private Use Area ranges
of the Nerd Fonts glyph sets, so that other private use codepoints, which
may be used by fonts that do have styled variants, keep their style.
- Use the SIMD base64 decoder
- Allow ids of up to 263 bytes, the 128 byte limit in the spec is an error
- Drop transient records when a program run with launch --hold exits, even without shell integration
- Drop done and error records when a key is pressed in the window
- Only build the records list when there are watchers
- Count the raw bytes of a report against the length limit
- Strip only ASCII whitespace and discard reports with over long keys regardless of case
- Identical reports do not change which record is shown in the tab bar
When several windows in a tab report a program status, tab.program_status
now appends the number of windows in the most urgent status, e.g. two
windows blocked on the user. Ties between windows are broken by the most
recently updated record instead of the window order.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implement revision 0.4 of the Program Status Protocol, which lets a
program report whether it is idle, working, done, blocked on the user
or failed, and why.
- Parse and validate reports per the spec: limits, base64 text without
control characters, malformed ids discard the report instead of
falling back to the root record, unknown states are ignored
- Keep up to 256 records per window (LRU eviction), with clear removing
a record and its descendants and app inherited from ancestors
- Reply to the feature detection query with supported states and kinds
- Lifetime: working/blocked/idle records are dropped at a new shell
prompt (OSC 133;A), done/error are dropped when the window gets focus,
a full reset (RIS) removes every record
- Expose records via tab.program_status in tab_title_template, the
output of kitten @ ls and a new on_program_status_change watcher
Spec: https://www.superlogical.com/rex/docs/build/program-status
Ref: ghostty-org/ghostty#14560, ghostty-org/ghostty#14630
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a pipeline does not declare the a, b or persist textures they are
freed, along with the per window framebuffers for them, but the per window
generation counters are left alone. Loading a pipeline that declares them
again recreates the textures without recreating the framebuffers, since the
generations still match. Passes into those textures then bind framebuffer 0,
which is the backbuffer, so they draw over the terminal contents and only
what the shader draws by itself remains visible.
Reset the generations when the textures are freed, so that the framebuffers
are attached afresh when the textures come back.
Both axes of a scroll event are dispatched, so a diagonal gesture can fire
both, and the event is consumed if either axis is mapped. An unmapped event
continues a mapped gesture only if it scrolls along axes without any mappings.
- Only call into Python for scroll events when the wheel is mapped for the
current modifiers and mode, using a bitmap of wheel mappings built in
set_options(), and only when a step completes
- Do not swallow the momentum of an unmapped gesture that follows a mapped one
- Do not carry a partial step over to a different window or modifiers or
across unmapped scrolling
- Count wheel steps without relying on the mouse tracking mode semantics of
scale_scroll()
- Return the result of the mapped actions from on_mouse_event()
- Ignore mouse_selection for the wheel, it would never be released
- Add integration tests for scrolling with wheel mappings
- Use SampleLevel() for the sprite samples in the cell fragment shader.
They are now inside a branch that is not uniform across a 2x2 pixel
quad at cell boundaries, where implicit derivatives are undefined. The
sprites texture has no mipmaps so LOD 0 is identical.
- Pack the skip text flag into the existing flat underline_exclusion_pos
varying instead of adding another one, to not reduce varying headroom
on older drivers that do not pack flat ints with floats.
- Make the requirement that callers rewrite every byte of an invalidated
buffer explicit with a dedicated alloc_and_map_vao_buffer_for_full_rewrite()
and drop the now unused frequently_updated parameter.
- Cross reference text_composition_strategy() in C and
text_contrast_is_identity() in Python so they are kept in sync.
Require ModeSymlink when checking the SymlinkToDir marker as it shares a
bit with the other-execute permission, use a single helper for the check,
avoid stat() on hidden entries that will be skipped and treat symlinks to
directories as directories in save file path completion.
Recognize the existing directory-symlink marker when scanning, filtering
and deciding which results can be selected. Resolve symlinks before file
filters and cover directory selection and filtered navigation.
The cell fragment shader sampled the glyph, underline, strike, cursor, and underline-exclusion texels for every cell. A space is sprite 0, and that sprite is empty, so those samples add nothing. The vertex shader now sets skip_text when the glyph, both decoration indices, and the cursor sprite are all zero. The fragment writes the background it already computed and skips the samples. A block cursor is sprite 0, so its color stays in the background. An underline, strike, URL underline, or beam, underline, or hollow cursor still samples. The foreground-only pass writes zero for a skipped cell.
On Linux, platform text composition is gamma 1 and contrast 0, which is pow(alpha, 1) * 1. TEXT_CONTRAST_IDENTITY compiles that function down to returning the color unchanged. legacy and any other numbers keep the old math. A config reload that crosses that line rebuilds the cell programs. The identity flag is only varied when the new gamma path is on, so the cell programs go from 18 to 27.
Frequently updated buffers were mapped with glMapBuffer. If the GPU is still reading that storage, the map waits. GL_MAP_INVALIDATE_BUFFER_BIT tells the driver it may keep the old storage for the in-flight draw and hand the CPU a new one. The cell upload and the selection upload already rewrite every byte, which this flag requires. Borders and padding still use the plain map.
This does not change a normal terminal frame on a modern GPU. On Wayland the next upload waits for a frame callback, and the cell draw finishes well inside that refresh. The map blocks only when one draw lasts longer than the gap before the next upload, which is software GL or a heavy custom shader, not scrolling or a TUI.
Replace exported get_dir files atomically so paths returned by Get/Add
never briefly vanish while another worker re-exports the same key.
Don't panic in Get for a key folder missing from entries.json.
Propagate errors from unlocking, document the lock()/unlock() contract,
and fix the NewDiskCache lock error test which checked the wrong cache
Key presses update the IME position, but cursor motion caused by child
output, such as the echo of committed text, did not. The next composition
then started with a stale anchor and its candidate window briefly appeared
at the old position before jumping to the cursor.
Once an IME composition has been seen, push the cursor position to the IME
whenever it changes outside a composition in the active window of the
focused OS window. Nothing extra happens until an IME is used, and there is
no timer, so no feedback loop with GNOME's done events.
Closes#10644
Fix the input wake scheduling issues
- Never stall input the main loop was woken for: the main thread parses on
signal turns too and accepts any chunk the I/O thread woke it for, and a
chunk is only marked as woken from the state the wake was decided on.
- Keep held deadlines across a wake and drop the duplicate main loop timer
for held input, so a held chunk is scheduled once.
- Accept a small chunk that grows before the main thread parses it, rather
than refusing it and needing another round trip.
- Only skip painting an OS window when none of its windows parsed new input,
and find held windows without a per screen search.
- Query only parsers that were read or have pending input, without taking
the children lock, and wake for removed children only when the main thread
did not request the close.
- Share one classification of pending input between the parser and the
I/O thread.