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.
Follow up to the previous commit fixing hangs when previewing named pipes:
- Skip previewing anything that is not a regular file (or a symlink to
one) in preview_for, before any previewer opens it. This avoids
unblocking and then breaking writers waiting on a FIFO and covers the
non-text previewers (images, video, archives, calibre, commands) too.
- Apply the text preview size limit to the symlink target instead of the
symlink itself, and enforce it while reading so that files growing
after stat() are also handled.
- Pre-allocate the read buffer based on the file size, as os.ReadFile does.
- Read ignore files during scanning with the same non-blocking reader, so
a FIFO named .ignore or .gitignore cannot stall the scan.
- Unblock goroutines stuck on FIFOs when tests time out.
Open text preview files in nonblocking mode and check the type on
the opened descriptor before reading. Reuse the same read for syntax
highlighting because it can reopen a path after the file changes.
bash is compiled with the paths to its system wide profile and bashrc
(SYS_PROFILE and SYS_BASHRC) and there is no way to query bash for them.
Previously kitty guessed locations in /etc, which fails on distros that
keep these files elsewhere, such as hermetic /usr distros like Clear Linux
(/usr/share/defaults/etc) or Nix (/etc/bashrc).
Now find the paths by scanning the bash executable for them, both in kitty
and in kitten run-shell (so it works on remote hosts via the ssh kitten).
The result is cached per executable in kitty. If the scan fails, or the
locations are explicitly specified via the environment, the previous
behavior is used.
Fixes#10819
Use Capture.ByteRange() from v2 instead of a hand-rolled rune to byte
offset mapping. The old mapping required capture offsets to be monotonic
across matches, so a capture inside a lookaround overlapping a later match
in non-ASCII text caused all matches to be silently dropped.
Also propagate match errors instead of discarding them. Drops the v1
dependency, v2 was already pulled in by chroma.
Shake only the window in which a bell occurred, using
d.bell_window_geometry, either side to side or in random directions.
Useful for shaking the window when a shell command fails. Add docs with
shell snippets to ring the bell on command failure and demo entries.
Fire the event directly from screen_bell() instead of piggy-backing on
start_visual_bell_at in the render loop. Previously the event only fired
when visual_bell_duration was non-zero and bells in windows that were not
visible fired it late, when the window was next rendered. Now only bells
in visible windows (in the active tab and not hidden by an overlay or the
layout) fire the event.
glfwGetWaylandCurrentMonitorFractionalScale() looped on
wl_display_roundtrip() until every monitor had received xdg_output
logical size and position, with no limit. Compositors do not send
these for an xdg_output created on an output whose global has
just been removed, so kitty would hang forever when creating a new OS
window after output churn.
Bound the wait to a few roundtrips and remember monitors for which we
gave up so we dont wait on them again. Re-lookup monitors after each
roundtrip, since a dispatched global_remove can free them.
Also track outputs that have been bound but not yet announced via
wl_output.done, so that a global_remove arriving before done frees them
instead of the dead output being announced later and living in the
monitor list forever.
Add the command-start, command-finish, alternate-screen-enter and
alternate-screen-exit events, which fire for changes in the active window,
and the active_window_command_running, active_window_alternate_screen,
active_window_command_state_age and active_window_alternate_screen_age
fields to KittyCustomShaderData, so shaders can show effects while
commands run and hide them in full screen programs.
Previously the cursor was always drawn after the pre-edit text, as the
cursor position sent by the input method was ignored, so one could not see
which character was being edited when moving inside the pre-edit text, as
with Chewing. Pass the pre-edit cursor from IBus, Wayland text-input and
macOS to kitty, in code points, and place the cursor there. On Wayland, do
not drop pre-edit updates that only move the cursor.
Also use the pre-edit cells rather than the original line under them to
size and color the cursor, so that it covers wide pre-edit characters.
The IME candidate window remains anchored at the start of the pre-edit text.
Fixes#10807
Store per color scheme auto theme state in a typed dataclass instead of
string built attribute names. Track which theme files were seen during
the directory scan rather than checking for existence afterwards, so a
file deleted mid-scan cannot invalidate unscanned themes. Reset
applied_theme when the applied theme file is deleted.
Always re-read theme files on config reload and apply the theme for the
current system color scheme. Previously, once the applied theme was
invalidated, reloads stopped refreshing theme files, so re-creating the
file had no effect until the next system color scheme change. This also
means theme files created after startup are now applied on reload.
Move the D-Bus service Exec line generation into a helper with a fast unit
test instead of copying the test binary and re-executing it. Refuse paths
containing a carriage return, since D-Bus decodes \r as a newline and
rejects .service files containing a raw carriage return.
Track move source identities in drop_status rather than parsed_uri, and
also compare birth times where available, so that a replacement reusing
the inode number of a deleted source is not removed. Clarify the
changelog entry.
libbase64's stream decoder fails every call made after it has seen
padding, even an empty one, so the empty message that terminates a
stream was rejected. Also size the decode buffers for pre-sent and
drag item data correctly, so that very short padded chunks such as
QQ== are not rejected.
Fixes#10777
The standalone C tests compiled the glfw sources by including them and
stubbing internals and were not run by the test suite. Move the useful
parts of the markdown docs into the option docs and changelog.
is_case_sensitive_filesystem lost its true default when it moved into
the dnd struct, so remote drops always treated names differing only in
case as conflicting. Detect it properly and also probe for Unicode
normalization aliasing, since a case sensitive filesystem can still
treat differently normalized names as the same.