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.
A zero-length commit, from EOF or EAGAIN, no longer sets new_input_at.
The delay is measured from the first real byte.
vt_parser_input_wake() takes the caller's now. The I/O thread reads the
clock once per pass instead of once per child.
These three changes are worth doing because they shorten the wake
decision and remove a second opinion about what is small.
A child exit no longer wakes on its own. The next iteration queues the
child and wakes the main thread, so the old child_closed branch was a
second wake and a second copy of the rate-limit check.
vt_parser_commit_write() no longer returns whether the pending bytes
are small. Nothing read that bool, and the real check is
vt_parser_input_wake().
A small write that already used its early wake, and a signal, share one
rate-limit deadline. The sooner of that slot and a large chunk's own
deadline still wins.
input_held was one flag for the whole process. A background window
waiting out input_delay skipped cursor blink, drags, and swap retries
in every OS window. The flag now lives on the OS window of the held
child. Other windows keep painting. The flag is cleared at the start
of each parse, so a window paints again once its bytes are read.
A large chunk stayed large_ready until the parser cleared its stamp, so
every later read woke the main loop again. Record the stamp on wake and
ignore that chunk until the parser replaces it.
Bytes already scanned and left in the buffer were counted with the next
write. A short write after a large tail waited out input_delay, while
the parser would have taken it immediately. The stamp now stores the
buffer size at that moment, and only bytes committed after it count.
A large write was scheduled on two clocks. The I/O thread woke the main
loop once the previous wake was input_delay old. The parser then refused
a chunk of at least 1KB until input_delay had passed since its first
byte, and armed a timer for the rest. That first turn still painted:
repaint_delay only skips a paint when nothing was parsed and the last
paint is recent. The timer turn parsed the bytes and painted again right
away, because a turn that parsed input ignores repaint_delay. With both
delays at 1ms this was two trips, and often two paints, per large write.
input_delay 0 never holds, so it did the work once and used less CPU.
The I/O thread now asks the parser for one deadline, new_input_at +
input_delay, and sleeps until then. A chunk under 1KB still wakes
immediately, at most once per input_delay. A buffer within 16KB of full
wakes immediately, which is when the parser already refuses to hold.
If a frame callback or another event wakes the main loop while bytes are
held, render returns without painting. The hold timer is already armed.
A thumbnail still paints. A child that exits is taken off the poll set,
so the hold can no longer see it. The main thread is woken when that
child is queued and flush-parses its final output.
A signal stays latched until that wake. signalfd is emptied on the first
poll, so a later poll cannot see the same signal. Without the latch, a
signal that arrived inside the delay was dropped when the next poll had
no parser deadline.
A scanned tail left in the buffer has its timestamp cleared. Those bytes
were already looked at. They are not input waiting out input_delay.
Treating a zero timestamp as ready made every later wake skip the delay.
If monotonic() returns 0 at startup, the commit stores 1, so 0 stays the
empty timestamp and a real chunk still gets a deadline.
- Anchor the IME cursor rectangle at the column the pre-edit text is
actually drawn at, which is shifted left of the cursor when the text
would not otherwise fit on the line, instead of at the cursor column.
- Store the IBus cursor geometry cache per input context rather than in
a function static, only update it after a successful send and reset it
whenever a new input context is created.
- Add a test and a changelog entry.
During IME composition kitty reported the cursor rectangle at the end
of the pre-edit text (overlay_line.cursor_x), so every keystroke that
grew the pre-edit moved the rectangle and the IME candidate window
jumped horizontally.
Report the start of the pre-edit text (overlay_line.xstart) instead,
which is stable for the whole composition, and only send position
updates when it changes. Also deduplicate IBus SetCursorLocation the
same way the Wayland text-input path already does.
Add a small Slang lexer and top level declaration parser to slang.py, and
SlangShaderQuery which runs the slangc preprocessor when an answer could
depend on it. Use it for:
- Detecting pointer_map(), so that comments, #if 0 blocks and calls no
longer count, macros are honored, and a pointer_map() that is not public
or does not return float2 is reported instead of failing obscurely. The
result is cached alongside the pipeline module, so a cached load does
not run slangc.
- Applying pipeline var directives, which now work for declarations
spanning multiple lines and match by name as documented.
- Parsing the builtin shaders, with identical results for all of them.
Also cleanup minor issues form previous PR
- Ignore pointer_map() in groups that only draw to part of the screen
- Share the pointer position conversion between glfw.c and mouse.c
- Pass POINTER_MAP_SIZE to the pipeline as a define instead of
duplicating it
- Do not free the pointer map render target on every pipeline reload
- Document what pointer_map() may depend on and when d.mouse_pos lines
up with the pointer
Times laying out and drawing the horizontal tab bar for every built-in
style with 10, 50 and 200 tabs. Use --compare-with to also time
kitty/tab_bar.py as it is at some git revision.
Laying out the tab bar draws each tab several times, so cache evaluated
title templates for the duration of a single update, unless the template
depends on the length available for the title. Also skip measuring the
overhang of truncated tabs once there is no free space left, as then it
cannot change the layout.
Leave custom draw_tab functions a cell of slack per truncated tab, as
their overhang may grow with the space they are given. Add fade style
tests and a shared helper for horizontal tab bar tests.