Since the pty name is now obtained from the master fd, check that it
refers to the same device as the slave fd, so that a mismatched pair
passed to spawn() raises an error instead of silently giving the child
the wrong controlling terminal. Also merge the changelog entry into the
existing macOS bullet.
On macOS, ttyname_r() calls devname_r(), which lstat()s every entry in
/dev until one matches. New ptys are appended to /dev, so naming the pty
of a new window looks up every older entry, and one stuck entry blocks
spawn() on the main thread with the GIL held, freezing kitty.
ptsname_r() on the master returns the same name with one ioctl() and a
stat() of that single path. Other platforms keep ttyname_r(), which does
not walk /dev there in the normal case.
Fixes#10741
Move EvalSymlinksThatExist to paths.go as it is no longer used only for
tar extraction, create the test symlinks in a deterministic order and
add a changelog entry for #10740 noting that it affects all atomically
saved files, not just clipboard output.
Follow up to the merge of #10738. Use utils.AtomicUpdateFile to move
downloaded data into place instead of hand rolling the stat/chmod/rename
sequence. This fixes:
- Permissions of existing destination files not being preserved, as the
chmod was applied to an already closed file
- An empty file being left at the destination if the rename failed, as
the permissions probe opened the destination with O_CREATE
- Symlinks at the destination being replaced by regular files
- No fsync before the rename
Also encode converted images into memory and write them atomically, so
a failed encode no longer truncates and then deletes an existing
destination file.
The copied paths have their symlinks resolved, so files under a HOME that is
itself reached via a symlink, such as /home -> /usr/home, were not
recognized as being in HOME and were copied to an absolute path on the
remote machine. Also add the PR reference to the changelog entry for #10737.
- Guard against the quotes post processor producing start > end for a match
consisting of just a single ASCII quote
- Use char_before() in the URL trailing punctuation loop and avoid computing
the closing bracket twice
- Add PR reference to changelog entry
The post-processors index the text by byte, so when looking at the
character before a position they decoded only the last byte of
multi-byte quotes such as ‘’ and “” and never matched them. URLs kept
the closing quote and paths kept both quotes. When the closing quote was
just outside the match, the start was also advanced by a single byte,
splitting the opening quote and producing invalid UTF-8, for example,
for the file name in wget's "Saving to: ‘index.html’".
This worked before the hints kitten was ported to Go.
The archive reused the metadata of the top level directory for all nested
directories and both bootstrap implementations recreated directories with
the remote umask.
Stat every directory when building the archive, passing the stat result
explicitly to the header callback and skipping directories that vanish or
are replaced by something else while being copied.
When deploying, move directories not present at the destination intact,
replacing any dangling symlink or file in the way, and merge into existing
directories keeping their permissions. The shell implementation falls back
to creating the directory and merging if the move fails. Make the
temporary directory deletable before removing it as copied directories can
lack write or search permission.
Closes#10727
Program output can remove the highlighted link under the mouse, which
left the hand pointer and the hovered link state stale until the mouse
moved or the modifiers changed. After parsing output, if the highlight
in the hovered window was cleared, reset the hovered link and re-derive
the pointer shape, using the current mouse tracking mode.
Closes#10725
Refresh hover feedback only in the hovered pane when modifier changes alter
whether a single-click link action matches. Preserve resize and drag cursors
and keep OSC 22 pointer updates independent of modifier handling.
Compute link modifier masks while finalizing mouse mappings, clarify the
documentation, and cover the reported regressions with mock pointer events.
Lines whose thickness is specified in pts are now scaled by the ratio of
the current font size to the configured font_size, so they no longer look
too thin when zoomed in or too thick when zoomed out. At the configured
font size nothing changes. This combines with the existing multicell
scale for the text sizing protocol. Sprites are already cached per font
size, so no cache changes are needed.
For the window title bar, the drawn border is kept at least half a pixel
inside the pixels reserved for it, since the rounded rect shader
anti-aliases over a one pixel band on either side of each edge and would
otherwise bleed onto the rendered title.
Fixes#10362
New color_scheme_dark, color_scheme_light and color_scheme_no_preference
options. When any of them is set, the ssh kitten sends the color schemes
for all three system color schemes to kitty, which applies the one
matching the current system color scheme and switches between them when
the system color scheme changes. color_scheme is used for modes without
a specific color scheme.
The colors are applied in a new session color layer, above the colors of
the window and below colors set by programs. They are associated with the
color stack entry pushed by the ssh kitten and are removed when it is
popped, so nested sessions work and the colors are restored on exit.
Configs that only use color_scheme continue to use escape codes exactly
as before, as does the kitten when running inside tmux.
Fixes#10724
Colors in a window are now tracked in layers: the global configured colors
(kitty.conf and the automatic color theme), the colors of the individual
window (launch --color, --copy-colors) and the colors set by the program
running in the window (escape codes, set-colors without --configured).
Switching between light and dark themes changes only the global layer, so
colors set by the ssh kitten, by programs or by launch --color are no
longer overwritten.
Only the colors set by the program are saved on the color stack, so
popping the stack, for example when exiting the ssh kitten, uses the
current theme colors for everything else rather than those from before
the theme change. launch --color colors now also survive config reloads.
set-colors --configured still replaces colors set in the matched windows.
Fixes#10724
Follow configured mouse actions for the hand pointer and hover underline,
and refresh both on modifier changes without requiring mouse movement.
Cover URL detection, hyperlink highlighting, configuration variants, and
link dragging with focused regression tests.
This makes the pid consistent with the cmdline, cwd and env reported
for the window, which already skip over wrappers kitty inserts such as
/usr/bin/login on macOS and the wrapper used for --hold.
The cmdline, environment and working directory of a window, as reported
by kitten @ ls, used for matching windows and saved in the window state,
now come from the root process, skipping over wrappers kitty inserts
such as /usr/bin/login on macOS. Previously on macOS these described the
login process. Cache the resolved root process so that this is cheap.
When the root process was not in the foreground, cwd=root used the cwd
of the foreground process instead of the root process. Also skip over
wrapper processes that kitty itself inserts, such as /usr/bin/login on
macOS and the run-shell kitten used for --hold, using their first child
as the root process instead. Previously on macOS cwd=root always
resolved to the home directory, the cwd of login.
On Linux, read the children of all threads of a process, since
multi-threaded programs such as kitten can create children from any
thread.
Make cwd_of_child and modify_argv_for_launch_with_cwd use the same
logic for deciding when the reported cwd applies to cwd=root.
Closes#10720
image.Decode failures fell through to encoding a nil image, causing a
panic. Read the image into memory instead of streaming from an open file,
which also fixes file descriptors leaking on the DecodeConfig error path
and for PNG images, which were never closed. Include the path in decode
errors and drop the wasteful raw RGBA sized buffer preallocation.
Closes#10715
The selection dirty check computed iteration data in a different
coordinate system than apply_selection() used to store last_rendered,
so the two never compared equal when scrolled back, causing the
selection buffer to be re-uploaded and the window redrawn every frame.
Use a common helper for both.
Fixes#10714
Receiving a regular file over an existing symlink or hard link used to
truncate and overwrite the file the link points to. Instead, write
received files to a temporary file in the destination directory and
atomically rename it into place once the transfer completes, as was
already done for delta transfers. This also means interrupted transfers
no longer leave truncated files behind.
If the destination directory is not writable, fall back to writing in
place, but only for regular files with a single link, so that no other
file can be affected.
Also use stat rather than lstat when deciding whether to use delta
transfers, so that symlinks to large files can use them, and remove
the temporary file of failed or aborted delta transfers.
Closes#10713
The title bars shown only for a window drag were hidden before the drop
was classified, which moves the windows, so a drop on a title bar was
treated as a directional insert instead of a swap.
Classify the drop in on_window_drop() before hiding them. On Wayland the
drag source can finish before the drop is delivered, so when the drop is
on kitty, on_drag_source_finished() now leaves hiding them to the drop,
falling back to hiding them if the drop never arrives.
Closes#10709
wayland_titlebar_color, macos_titlebar_color, scrollbar_handle_color and
scrollbar_track_color store a special value in their lowest byte with
actual colors shifted into the upper bytes. The Go client sent them as
plain RGB values, so kitty interpreted the blue component as the special
value, for example, scrollbar_track_color=#ff0000 used the foreground
color. It also rejected special values such as background and dark.
Encode them the same way as the Python parsers do.
Pass the CLI options to parse_colors_and_files instead of reading
global state, and have it set all and configured when reset is
specified, matching the Python client.
Read conf files with the standard config parser so that tabs,
indentation, long lines and include directives work, and report
invalid colors instead of silently ignoring them. Non-color settings
and special values of colors such as wayland_titlebar_color are still
ignored, as in the Python client.
Allow special_parse functions to take over fields that are backed by
options in the generated Go remote control code.
Skip color argument parsing for --reset, as documented and already done
by the Python command path. Add a payload-creation regression covering
invalid colors, missing files and valid colors with and without reset.
Go's min/max propagate NaN, so "nan" got past parse_opacity and failed
later with an unclear json.Marshal error, while the Python parser
silently clamped it to 0. Reject NaN in both, report a clear error
message for invalid opacity values, and replace the regression test with
a table test of parse_opacity covering clamping and invalid inputs.
animation_duration sets how long animation_progress takes to rise to one,
after which it stays there, so effects can fade in and stay on. Previously
groups with no stop duration, such as toggled ones, always had a progress
of zero.
animation_reverse makes a group play its animation in reverse when it stops,
for any reason, instead of turning off immediately. With yes it takes as
long as animation_duration, or a number of milliseconds can be given.
Stopping part way through rising reverses from the current progress and
starting again while reversing rises from there.
animation_loops, used with animation_reverse, plays the animation forwards
and in reverse again after the first reverse, without holding at one, for
effects such as blinking a few times.
Also fix attached groups not having the same animation_progress as the group
they are attached to, as documented, and explain why the per-group values
are in KittyTextures rather than KittyCustomShaderData.
Fixes#10693
Since the notification being replaced has no dbus id yet, it cannot be passed
as the replaces argument to Notify, so close it once the notification server
creates it.
When the connection of an existing ControlMaster to the server dies
without the master noticing, for example after a network change or
suspend, new sessions using it hang. ssh -O check does not detect this
as it only talks to the master over its local socket.
Check the master in parallel with starting the session, using a request
that requires a round trip to the server, so that there is no added
latency when the master is healthy. If the master does not respond in
time, kill the stuck session, stop the master and start the session
again over a new connection. Similarly time out the port forward request
used by forward_remote_control and retry it with a new master.
Fixes#10691