Add vulkan-headers to the Linux dependencies, and fail freezing on Linux
if either the OpenGL or the Vulkan GPU driver, or the built-in shaders
for its shader target, are missing. Document vulkan-headers as a build
dependency.
A new panel created via single instance now runs in the working
directory of the invocation, rather than that of the first instance, as
commands run in existing panels and other single instance commands
already do. The environment of the invocation is cleaned up with
process_env() as for other single instance commands, so that variables
such as XDG_ACTIVATION_TOKEN and VTE_VERSION are not passed to the
commands.
Commands sent to an already running panel or quick access terminal, both
in existing panels and in newly created ones, are now user launches
passed to the launch wrapper. They have no source window, since they are
not run from any window in the panel. A new panel without a command runs
the shell instead of the run-shell kitten, so the wrapper sees the actual
shell, as for a panel started without single instance.
Closes#10900
The layout did not reserve space for the border of a single window, so
the border overlapped the margin and, when the margin was narrower than
the border, extended past the edges of the OS window. The negative
coordinates were then parsed as unsigned, which with rounded borders made
the whole window be covered by the corner fill, hiding its contents.
Reserve the border in layout_single_window_group whenever a full border
is drawn around the window, including when a visible dock causes borders
to be drawn, account for it in the initial OS window size in cells, and
parse border rects as signed integers, clipping them to the OS window.
Fixes#10899
The HarfBuzz font was created before the named instance or axis
coordinates were applied to the FreeType face and was only resynced if
the face had a transform matrix. So shaping used the default variation
coordinates, which broke fonts that substitute glyphs based on axis
values via GSUB FeatureVariations, such as the cursive (CRSV) axis of
Annotation Mono.
Adds a test using a small subset of Annotation Mono (SIL OFL 1.1).
Fixes#10897
The fix for CVE-2026-54056 only made remote regular file creation
exclusive. A remote source could still send a symlink and then a
directory with the same name, as names were only de-duplicated on
case insensitive filesystems. CreateDirAt() would then follow the
symlink and the directory's children would be written outside the
staging directory.
Always de-duplicate names, create remote directories exclusively and
never follow symlinks when opening a newly created directory.
Animations are only scanned in the windows of the active tab, so if the
previously active tab had no animations, scanning stopped and was never
restarted when switching back. Request a rescan when the active tab
changes.
Fixes#10894
- Treat trailing empty SGR color parameters as zero, matching the terminal
- Ignore the color space id in colon form RGB colors (38:2:id:r:g:b)
- Fix bright colors (90-97, 100-107, 38;5;8-15) being re-emitted off by one
- Handle parse errors explicitly and simplify color target selection
- Add tests for SGR state parsing
The dialog was drawn by writing newlines and relying on the terminal to
wrap long lines, recording clickable ranges assuming nothing scrolled or
wrapped. When the content was taller than the window, the screen
scrolled and every clickable range was off by the scroll amount.
Now the full layout is computed up front, with clickable ranges relative
to it, and rows are drawn with absolute cursor positioning and line
wrapping disabled, so the terminal never scrolls or wraps. The boxed
choice layout is used only if it fits entirely, otherwise the compact
one is used, and if even that does not fit, the content is bottom
aligned so the choices remain visible. Choices too wide for the screen
are truncated with an ellipsis.
Also fix:
- The hidden text placeholder not being clickable when it wraps over
multiple lines, its clickable range going stale after a resize, and
its range including one cell too many.
- Compact choice ranges being computed by iterating over a map, putting
them in random order when several choices share a line.
- An empty box row or compact row being output when the first choice is
wider than the screen.
- truncate_at_space using a cell width as a byte offset, splitting
multi-byte characters, and looping forever when a character is wider
than the available width.
Closes#10883
Recheck the path key before updating the cache. Include the inode so a replacement with the same size and modification time gets a different key. Version the key to invalidate previously cached previews.
Retry once when a changed path still resolves to a regular file.
A bell in the active window was never marked as needing attention, even
when the OS window did not have keyboard focus, so the tab bar bell
symbol was not shown. Now a window needs attention unless it is both
active and in the focused OS window.
Since the active window can now need attention, also:
- Clear needs_attention when the OS window gains focus, as
focus_changed() is a no-op if the window became active while the OS
window was unfocused, which would leave the indicator stuck.
- Use the bell color for minimal borders of an active group needing
attention, instead of the active color (or the fallback green when
active_border_color is none).
Fixes#10880
As with the CoreText renderer, a glyph that is rescaled to fit its cell is
moved so that its ink starts at the left edge of the cell, so that marks that
hang to the left of it, as in polytonic Greek capitals, are no longer cut off.
Port the overhang allowance from the FreeType renderer: a glyph wider than
its single cell by at most 2/9 of the cell width, with a minimum of 2px, is
cropped rather than rescaled. Previously any glyph whose right edge was more
than 1px past the cell was rescaled, shrinking glyphs such as the d with
caron of Cascadia Code and the texture healing alternates of Monaspace.
Widths are measured per glyph, as with FreeType, so that combining marks do
not cause their base glyph to be shrunk.
The left overhang of a glyph is now taken into account, and a glyph that is
rescaled is moved so that its ink starts at the left edge of the cell, so
that marks that hang to the left of it, as in polytonic Greek capitals, are
no longer cut off. Glyphs that extend past the right edge of the cell are
moved left as far as their left bearing allows, as with FreeType.
Also fix the tests for this to run on macOS: face_from_path() ignored the
font size on macOS and the tests treated pixels with only color bits set as
ink.
Fix concat_cells() for 32 bit sprites, broken since the SIMD compositing
change, which treated the 0xRRGGBBAA sprite pixels as RGBA bytes, producing
an opaque white image.
A glyph whose bitmap is wider than its cell is rendered again at a
smaller font size so that it fits, unless it is wider by no more than
two pixels, in which case it is cropped. That allowance is absolute, so
it covers less of the cell as the cell grows, and fonts with glyphs
that overhang their advance by design end up on the wrong side of it:
the texture healing alternates of Monaspace and 0xProto, or the d with
caron of Cascadia Code. Such a glyph is drawn visibly smaller than its
neighbors, at one font size and not at the next.
Make the allowance proportional to the cell width: 2/9 of the cell,
which is the 2px the rule was originally tuned for at the 9px cell of a
typical monospace font at 11pt and 96 dpi, with a minimum of 2px for
smaller cells. That keeps the widest Monaspace alternate, 14% wider
than its cell, at full size. A glyph that overhangs by more, such as a
Greek capital whose breathing mark and accent hang well outside the
cell, is still rescaled, since cropping would remove the marks.
Closes#10879
Timers are dispatched outside the main loop tick, so state changed by
them was not rendered while the OS window was otherwise idle, only
catching up when some other event woke the loop. For example, a custom
tab bar refreshed from add_timer, or actions mapped to mouse clicks,
which are dispatched from a timer after click_interval.
Request a tick after every Python timer callback, after dispatching
pending clicks and when marking the tab bar dirty.
Closes#10878
prepare_to_render_os_window() decided whether a window needs to be rendered
in layers before calling send_cell_data_to_gpu(), which is what updates the
graphics layers. So on the frame in which an image first becomes visible
grman_has_images() returned a stale false, the window was rendered without
the image, and if nothing else triggered a redraw (for example, the cursor
is hidden so not blinking) the image did not appear until some unrelated
event such as mouse movement.
Fixes#10875
The focus state of the decorations comes only from keyboard enter/leave
events, but the decorations were only re-rendered on configure events and
title changes. So they showed a stale focus state whenever focus changed
without a following configure, for example, when switching between tabbed
windows in niri, which keeps all tabs activated.
Re-render the decorations on keyboard enter/leave, looking up the window
again after the focus callbacks have run, since they can close it.
Also:
- Ignore the activated state in the change detection, as focus is tracked
separately, to avoid rendering twice per focus change.
- Never create decoration surfaces in ensure_csd_resources() for windows
that should not be decorated, such as fullscreen windows. Title changes
while fullscreen could previously create them from a stale state.
- Recreate the decoration surfaces when they are missing even if the
window state is unchanged, otherwise the resize borders were not
restored after leaving fullscreen with hide_window_decorations
titlebar-only.
Based on the patch by Ole Jørgen Brønner.
Closes#10873
Dragging the mouse over text drawn in the tab bar outside the tabs, such
as text a custom tab_bar.py draws below the tabs of a vertical tab bar,
selects it, and releasing the button copies it like a window selection
(primary selection, then copy_on_select). Clicks and double clicks on
empty space and presses on tabs behave as before.
Based on the draft in #10870, with these additions:
- Movement within drag_threshold selects nothing, so a slightly jittery
double click on text still opens a new tab.
- A selection whose release was lost does not keep capturing the
mouse: it is cancelled by a press outside the tab bar (which then goes
to its normal target), by motion with no button held, by any press in
the tab bar, and by the OS window losing focus.
- The pointer shape is reset after the press or release that starts or
ends a selection, instead of being left as the drag shape.
Fixes#10869Closes#10870
The prompt now shows the directory relative names are saved in, taking
--base-dir into account, and notes that the .kitty-session extension is
added automatically. File name completion in the prompt is now relative
to that directory instead of the cwd of the active window.
See discussion #10867
Shader animation events are accumulated per OS window and only consumed
when the window is next rendered. A focus-out followed by a focus-in with
no rendered frame in between, as happens when the window is hidden and
shown again, or a brief focus steal within one repaint interval, left both
bits pending. The state machine then treated them as simultaneous, so the
focus-out hard stop prevented os-window-focus-in groups from starting and
groups started by focus-out were turned on while focused.
Now a focus change replaces any pending opposite focus change, so only the
final focus state is reported. Genuinely simultaneous events, such as a
click that moves focus away, still give focus-out priority.
Closes#10871
The VS15 branch of draw_combining_char unconditionally moved the cursor
back by the width removed from the char. When the char was on the
previous line (cursor at x=0 after a soft wrap) this wrapped cursor->x to
UINT_MAX leading to out of bounds reads and writes. Only move the cursor
when it is on the same line as the char. Also preserve the soft wrap
marker in the cells cleared by halve_multicell_width.
File names, archive member names, symlink targets, error messages and
ebook metadata were written to the terminal unsanitized, allowing
crafted names to inject escape codes (e.g. OSC 52 to overwrite the
clipboard) merely by highlighting the entry.
A program running in the terminal could use edit-in-kitty to set --logo=/dev/zero
which would cause the image converter to read an infinite stream, blocking the
kitty main loop and consuming unbounded memory.
Docks can now be resized in whole cells by dragging their inner border,
with the resize_window action and with kitten @ resize-window, where
wider or taller always means bigger whatever the edge of the dock. A
dock keeps at least one cell and grows only into the content it is
docked to, so the docks inside it are never shrunk. OS window docks do
not shrink the tab docks of any tab, and when dragged, the other tabs
are re-laid out once, at the end of the drag. Percentage sizes stay
percentages. The new size is stored in the DockSpec, so it is reported
by kitten @ ls and saved in sessions. Resetting window sizes does not
change docks, as they are not part of the layout.
Previously the inner border of a dock showed a resize pointer but
dragging it did nothing, or in the Tall layout moved a layout divider.
Fixes#10857
Do not track decoration touches that start an interactive move or resize,
the compositor takes the contact over and need not send its up event, which
left the contact active and caused the next decoration touch to be ignored.
Drop a stale tracked contact whenever a new down arrives with the same id,
wherever it lands. A titlebar button held down by one finger no longer
blocks moving or resizing windows with another.
Restore the old mouse behavior of hit testing titlebar buttons only by x, so
that a button is still activated when released after dragging the pointer
below the titlebar.
Update the input serials only for decoration touches that are handled,
including their up events. Share the titlebar commit code between the
pointer and touch paths, remove checks that can no longer fail, fix
indentation in decoration_surface() and add a changelog entry.
OSC 9;9;path is now treated as a report of the current working directory,
like OSC 7, instead of popping up a desktop notification. Other ConEmu
numeric OSC 9 sub-commands (1-12) are ignored rather than shown as
notifications.
Scrolling down (CSI T) could cut off the lower rows of a scale > 1 text
sizing character at the bottom of the screen. Adding a combining char to
it then wrote past the end of the line buffer in add_combining_char and
rewrapping on resize read past the end of the line buffer in
copy_multiline_extra_lines.
Multiline chars that are cut off at the edge of the screen or of the
history buffer, by scrolling or by inserting lines, are partially
scrolled off and are rendered as such, so they are kept. Code walking the rows of a multiline char now only visits
the adjacent rows that actually continue the char, rather than trusting
the y and scale of a cell, so it stays in bounds and does not modify
unrelated cells for partial or torn chars.
Chars that would be torn, i.e. left with rows from unrelated lines
adjacent to their remaining part, are removed. This happens when
scrolling with margins, when a partial char is moved away from the edge
of the screen by scrolling or deleting lines, when inserting lines pushes
the lower rows of a char straddling the bottom margin out of the scroll
region, and when a partial char
cut off at the bottom is no longer at the bottom after a resize. Rewrap
drops partial chars, as it already did for chars with missing top rows,
placing cursors that were on them where the char would have been.
The checks for torn chars are skipped unless a multiline char has been
drawn in the screen, and chars cut off at the bottom of the screen,
which can only be created by scrolling down or inserting lines, are
tracked so that
linefeeds do not need to scan for them.
A hard reset now clears the alternate screen as well, so that the flag
tracking whether multiline chars have been used can be reset.
Also fix the lower rows of multiline chars being lost on rewrap when the
lines after the char were continuations that fit on its first row.
Create the temporary directory used for staging drops lazily, on the first
drop, instead of at startup, so the kitten works in directories that are not
writable when nothing is dropped into them.
Fixes#10855
An OS window dock is shown in every tab of its OS window, below the tab
bar and outside the docks of the tab, and lives as long as the OS window.
It is a single window running a single program, which is kept in the
active tab: it is moved to the new active tab on every tab switch, by a
new C function that moves the window between tabs of an OS window
without recreating its GPU resources. Every tab reserves the space for
the OS window docks, so switching tabs does not resize any windows.
The docks are not closed with tabs and do not keep a tab open, stay in
their OS window when the tab containing them is moved to another OS
window, and are closed when the last other window in the OS window is
closed. They are listed as part of the active tab, and the dock entry of
every docked group in the output of kitten @ ls now has a scope of
window, tab or os-window. They are saved in sessions, once per OS window.
Fixes#10854
Every on_resize and on_focus_change took its own 0s timer, so creating many
windows from a single callback filled the fixed size glfw timer table and
add_timer() returned 0, silently dropping the watcher calls. Now watcher
calls are queued and delivered in order behind a single pending timer, and
only when the window actually has a watcher for the event. Calls made during
delivery go to the next batch, preserving the recursion guard the timer
exists for.
Also fix add_timer() leaking a reference to the callback when the timer
could not be added.
Fixes#10853
A tab moved to another OS Window keeps its session, and new tabs and OS
Windows created for moved tabs and windows belong to the session of what
was moved. A window keeps its own session, which may be none, wherever it
is moved, so --add-to-session=! is respected; a window of no session
belongs to the session of the tab it is in.
Add Window.effective_session_name for the "window session, else its tab's
session" rule that was duplicated in five places, and use it in launch as
well, so --add-to-session=. and --cwd=current agree with
new_window_with_cwd. OS Windows created by launch --type=os-window or for
moved tabs and windows now also record their session.
Closes#10851
Report an error before writing if a filtered session serializes to
nothing. This keeps an existing session file intact and avoids
creating an empty one at a new path.
Let preview renderers supply extra cache key data instead of checking for
the cmd_renderer type. Include the command line in the key for custom
previews and the video_preview settings in the key for video thumbnails,
so that changing them no longer shows stale previews. GetPath and AddPath
now take this extra key data, replacing GetPathWithAlias.
Track the entry each path uses per extra key, so that previews of one file
with different settings do not evict each other. Do not remove an entry
while another path, such as another symlink to the same file, still uses
it. Cache hits are now recorded so that such shared entries are known.
Failing to remove an orphaned entry on a cache hit no longer turns the hit
into an error.
Fix ensure_entries() discarding unwritten changes when the entries file
does not exist yet, which lost the first path recorded in a new cache.
Also reset the path map when clearing the cache.
Custom preview commands receive the selected path. Include that path
in their cache key so that symlinks to the same file can have different
previews. Keep the resolved target in the key so retargeting a link
still invalidates its entry.
While rendering is paused, output can change the live scroll position,
pixel scroll offset, scrollback size and active screen. Image layers,
cursor visibility and the scrollbar used those live values while the
text was drawn from the frozen snapshot, so they drifted from it.
Capture the scrollback size and active screen at pause time and add
rendered_scrolled_by, rendered_history_count and rendered_on_main_screen
macros alongside rendered_pixel_scroll_offset_y. Move image layer
updates and scrollbar visibility and geometry into screen.c so the
renderer and the tests share the same code.
Closes#10847
When the first lines of the live prompt were in the scrollback, an unsigned
wrap made erase_last_command delete most of the screen and the newest
scrollback lines, including the live prompt. Delete the erased lines from
the middle of the scrollback instead, with a new historybuf_delete_lines()
that removes multicell chars cut by the deletion, and also remove such
fragments from the screen. Clear selections and the wrap flag of the line
above the erased lines on every path.
Also keep the last visited prompt on the same content when lines are
inserted or deleted (CSI L/M), forget it on a hard reset, and only fill from
the scrollback when unscrolling (CSI + T) if the scroll region starts at the
top of the screen, instead of overwriting the top line of the screen.
Store the last visited prompt as one row relative to the top of the live
screen (negative rows are in the scrollback) plus the viewport row it was
visited at, and derive the scroll offset when it is used. Previously it was
stored as a (viewport y, scrolled_by) pair that every code path moving lines
had to keep consistent by hand, which broke after erasing a command left
less scrollback than the saved offset, and when scrolling regions with
margins or reverse indexing.