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.
With a scroll offset the top of the viewport is in the output of the
command above the target. Check that last_visited_cmd_output and
scroll_to_prompt 0 use the prompt that was jumped to, for every offset
and when jumping forward.
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
Test that multicell chars not cut by the erase survive it: a wide char at
the top of the screen and a scaled char in the live prompt running from the
scrollback onto the screen. Check the full text after cutting large chars,
make the fragment check verify the parts above and below each multicell
cell, and run the standalone checks in subtests so that one failure no
longer hides the checks after it.
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.
Choose the tab to focus using only the windows that were actually saved,
moving the choice into a pure function so it can be tested without
constructing a TabManager. Test the first OS window logic with simple fake
tab managers instead of patching TabManager internals. Merge the changelog
entries and mention restore after logout.
TabManager.serialize_state_as_session wrote focus_tab as the index of the
active tab among all the tabs of the OS window, but loading a session
counts only the tabs it creates. With --match the tabs of other sessions
are not saved, so a session with such tabs before its active tab came back
on the wrong tab, or on its last tab once the index was clamped.
Write the index among the saved tabs. When the active tab is not saved, as
when it belongs to another session, write the saved tab with the most
recently focused saved window. That is the tab kitty focuses when switching
to the session while it is open, as window_for_session_name picks the
session's most recently focused window, so the session comes back as it was
last seen. Leaving focus_tab out instead would focus whichever saved tab
has the last focus command, usually the last one, which is arbitrary.
Boss.serialize_state_as_session passed is_first to the first OS window it
serialized, which is any but the focused one when there are several. With
--match that OS window can have no matching windows and write nothing, and
the next one then started the file with new_os_window, so loading the
session opened it in a new OS window instead of the current one. Whether
it did depended on which OS window had focus when saving.
Pass is_first to the first OS window that writes anything.
Always reply from the calibre worker, even when reading metadata raises or
calibre emits stray output, so that the request does not block until it
times out.
Accept cached calibre metadata generated for a different path to the same
file, as the disk cache key resolves symlinks. Otherwise a symlink and its
target keep invalidating each other's cache entry.
Dispatch replies by request ID from a single reader so concurrent previews receive their own metadata and late replies cannot interfere with subsequent requests.
The mouse-demo kitten popped and pushed the pointer shape on every mouse
event, and kitty applied each OSC 22 to the OS pointer immediately, so the
pointer briefly flipped to the default shape and back, restarting
animations. Only change the shape in the kitten when it actually changes,
and apply pointer shape stack changes to the OS pointer once per batch of
parsed child output.
Also have ApplyHoverStyles replace the current shape instead of pushing a
new one, so the shape stack does not grow as the mouse moves between
regions.
Fixes#10838
ColorProfile.as_dict() used the key cursor_text instead of the kitty.conf
name cursor_text_color, so get-colors listed the window override under a
different name than the configured value, which then shadowed it.
The bootstrap script extracted the tarball with umask 000, so tar
created any directories not present in the tarball, such as ~/.terminfo
and the ssh kitten data directory, with mode 0777. Since tar is run with
-p, the permissions of entries in the tarball are already restored
exactly, so the umask override is unnecessary. Remove it so that
directories not in the tarball respect the user's umask, matching the
behavior of bootstrap.py.
Fixes#10834Closes#10835
Check for conversion errors per option so a failed conversion returns
immediately instead of storing the error sentinel and continuing. Document
why macos_titlebar_color stays signed. Make the test meaningful on 64-bit
platforms by asserting negative values are rejected for the unsigned
options, and restore options afterwards.
RGB encodings can use the high bit of a 32-bit long. Decode the Wayland titlebar and scrollbar colors as unsigned values at runtime, matching their config converters. Keep the signed macOS titlebar sentinels.
Expect OverflowError for dimensions that exceed sys.maxsize, since
PyArg_ParseTuple rejects them before the PNG buffer validation runs.
Continue to expect ValueError for invalid dimensions and buffer lengths
that reach the validation code.
Use int64 for encoded special colors so RGB values shifted into the
upper three bytes remain positive on 32-bit platforms, while preserving
the negative sentinel values used for macOS titlebar colors.
Update the tests to use the same type, avoiding overflowing int constants
when compiling them on 32-bit platforms.
Export NULL_COLOR_VALUE using PyLong_FromUnsignedLong instead of
PyModule_AddIntMacro, which converts it to a signed long. On 32-bit
platforms this turns 0xffffffff into -1 and causes the generated Go
uint32 constant to overflow, preventing kitten from building.
Add a regression check for the exported value.
Replace the grab/release error handler pattern with a process wide
handler that is installed for the lifetime of the display. Errors are
captured by nestable traps identified by request serial numbers, so
traps only capture errors from requests made while they are open, and
errors from requests not covered by any trap are reported rather than
exiting the process.
Requests to windows owned by other clients (selection requestors, drag
and drop peers) are trapped individually, without waiting for a round
trip to the server, and without covering calls into the application.
Also fix reading uninitialized memory when handling a MULTIPLE
selection request whose requestor window has been destroyed, trap
errors when replying to drag sources, report failure to deliver drag
data, and fix detectEWMH() leaving the error handler installed on an
early return.