Commit graph

2227 commits

Author SHA1 Message Date
Kovid Goyal
0dfd9a832e
choose-files: Cleanup handling of special files in previews
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.
2026-11-09 08:42:30 +05:30
Zhizhen He
cdd278ee63
choose-files: Avoid hanging when previewing named pipes
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.
2026-11-09 00:21:45 +08:00
Kovid Goyal
e4988b522d
hints: Migrate from regexp2 v1 to v2
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
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.
2026-11-07 05:54:16 +05:30
devangpratap
f571f41ffb choose-files: Show tags instead of authors on the calibre preview Tags line 2026-11-05 14:57:26 -05:00
Kovid Goyal
d74472bd3c
choose-files: fix video and custom previews notbeing cached 2026-11-05 14:42:27 +05:30
Zhizhen He
c0c31df39c choose-files: Decode video preview thumbnails only once 2026-11-05 16:25:59 +08:00
Zhizhen He
4f689e2777 choose-files: Isolate custom preview command arguments 2026-11-04 10:56:49 +08:00
Kovid Goyal
5a6ea12f29
remote_file: Only reset the terminal when stdout is a tty
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
Avoids writing escape codes into piped output and test logs.
2026-11-01 12:00:40 +05:30
Kovid Goyal
a65a01e099
Cleanup previous PR
Keep edit_loop free of side effects: it now reports whether the editor
was started and edit_and_upload decides whether to keep the local copy.
Print the recovery path verbatim instead of Go-quoted.
2026-11-01 11:06:40 +05:30
Zhizhen He
32e6c525f9 remote_file: Preserve local edits after upload failure 2026-11-01 13:29:24 +08:00
Kovid Goyal
fcf697a5e0
Cleanup previous PR
Strip the optional leading = from values attached to short options, matching
rg semantics (-e=foo means the pattern foo). Replace the rg execution based
test with unit tests of the argument rewriting.
2026-11-01 08:23:00 +05:30
Zhizhen He
300f8c58cb hyperlinked-grep: Preserve short option values and stdin paths 2026-10-31 22:10:55 +08:00
Kovid Goyal
c93279d856
Cleanup previous PR
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
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.
2026-10-31 09:28:45 +05:30
Zhizhen He
b6abbf7655 desktop-ui: Quote portal activation executable paths 2026-10-31 11:43:54 +08:00
Kovid Goyal
f2f7927ec5
Merge branch 'fix-desktop-ui-kitten-path-fallback' of https://github.com/devangpratap/kitty 2026-10-31 08:40:55 +05:30
Kovid Goyal
ccecfa037b
Cleanup previous PR 2026-10-31 08:33:43 +05:30
devangpratap
cab970b015 desktop-ui: Use the kitten path fallback when os.Executable fails
enable_portal checked eerr instead of err after filepath.Abs, so a failing
os.Executable always aborted with a nil error and the Which fallback was
never used, while an Abs error was ignored. Check err, and report the
os.Executable error if kitten is not in PATH either.
2026-10-30 22:34:06 -04:00
Zhizhen He
df02769ed1 themes: Isolate picker cache from unicode_input 2026-10-30 23:05:31 +08:00
Kovid Goyal
9575920aab
Cleanup previous PR
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
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.
2026-10-30 18:28:40 +05:30
Zhizhen He
7629533607 dnd: Only remove original sources after a local move 2026-10-30 20:29:16 +08:00
Kovid Goyal
6adff8efff
Fix hanging dnd kitten test
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
2026-10-30 14:56:32 +05:30
Kovid Goyal
f5c6ad38be
Cleanup previous PR 2026-10-30 14:24:59 +05:30
Zhizhen He
c370368a48 dnd: Reject local moves that merge back into a source 2026-10-30 14:32:13 +08:00
Kovid Goyal
02b2b10d10
Fix flaky test
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
2026-10-29 22:05:37 +05:30
Kovid Goyal
cb88028abd
dnd kitten: Fix filesystem case sensitivity never being detected
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.
2026-10-29 21:46:25 +05:30
Kovid Goyal
1647103c57
Cleanup previous PR
- List the existing files that will be overwritten under the names they
  are stored as in the destination, not the dropped names
- Treat symlinks to directories in the destination as directories in
  find_overwrites, matching rename_contents, so the files that will be
  overwritten inside the symlink target are listed
- Replace an existing file or dangling symlink with a dropped directory
  instead of failing the drop after the user confirmed the overwrite
- Fail up front when a dropped file would replace an existing directory
- Also fold Unicode normalization when uniqifying remote drop names
- Probe for filesystem aliasing once before running the alias test
2026-10-29 21:41:44 +05:30
Zhizhen He
924dacc955
dnd: Detect filesystem aliases before overwrite confirmation 2026-10-29 23:55:24 +08:00
Kovid Goyal
40562972f4
Cleanup previous PR
Walk up from the drop destination using .. relative to its file
descriptor instead of its path, so the check is not fooled if the
destination is moved or replaced while the kitten is running. Also skip
the staging directory when copying, which guards against routes to it
the up-front check cannot see, such as bind mounts. Use readable
subtest names, check the chmod error in test cleanup and link the PR in
the changelog.
2026-10-29 17:32:35 +05:30
Zhizhen He
1a1495f564 dnd: Reject directory drops into their own descendants 2026-10-29 18:22:19 +08:00
Zhizhen He
ed4d37a9fa dnd: Skip local moves into the source directory 2026-10-28 20:36:04 +08:00
Kovid Goyal
c514311380
dnd: Use the existing conflict name template for local drops
Keeps conflict naming consistent between local and remote drops.
2026-10-28 17:38:44 +05:30
Zhizhen He
b7b29fe444 dnd: Preserve same-named local drop sources
Staging two entries with the same basename could fall back from a hard link to a truncating copy and overwrite the first source. Give each local source an unused staging name and use exclusive file and directory creation. Add regressions for files, directories, repeated paths, case conflicts, existing staging entries and symbolic links.
2026-10-28 19:45:51 +08:00
Zhizhen He
1e273aa289 Docs: Correct protocol references, examples and generated help 2026-10-28 13:24:43 +08:00
Zhizhen He
849c04153c choose-fonts: Fix style ordering for negative axis values 2026-10-27 22:52:24 +08:00
devangpratap
2519974e84 desktop-ui: Fix an invalid accent_color breaking the appearance settings 2026-10-26 14:05:23 -04:00
Kovid Goyal
a2086eb6a4
clipboard: Name both outputs when a case alias is detected
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
Identify the colliding output by comparing the probe files, matching the
message used for exact duplicates. Skip creating probe files when fewer
than two file outputs are given, so that a single output does not touch
the destination directory. Check both directories for leftover probes in
the test.
2026-10-26 20:18:48 +05:30
Zhizhen He
f0c67e1b97
clipboard: Reject output files with case aliases 2026-10-26 22:21:29 +08:00
Zhizhen He
4596a9baab
clipboard: Match duplicate checks to atomic write resolution 2026-10-26 13:36:01 +08:00
Zhizhen He
49e5695188
clipboard: Resolve symlinks before cleaning output paths 2026-10-26 13:12:42 +08:00
Kovid Goyal
a082d0b9ab
Fix test failure on macOS 2026-10-26 09:36:39 +05:30
Kovid Goyal
ddeb15b05a
clipboard: Download data once for outputs sharing a MIME type
Rather than every output sharing a remote MIME type writing its own
temporary copy of the data and decoding images separately, store the
data in a single temporary file per MIME type, decode images once and
save all outputs for that MIME type sequentially from it. The temporary
file is created in the directory of the first output where that is
possible, so a missing directory for one output does not affect others.

Also reject output files that resolve to the same path, following
symlinks as the atomic file update does, since saving to them would race
with the last write winning.
2026-10-26 08:53:47 +05:30
Kovid Goyal
3723c447aa
clipboard: Reject duplicate stream outputs for the same MIME type
Stream outputs write data as it arrives, so with fan-out to all outputs
sharing a remote MIME type, two outputs to the same stream would
interleave their data chunk by chunk, or encode two images into the
stream concurrently. Reject such duplicates with an error instead.
Also add a changelog entry for saving all outputs sharing a MIME type.
2026-10-26 08:48:06 +05:30
Zhizhen He
88fc77a5d6
clipboard: Save all outputs sharing a remote MIME type 2026-10-26 11:05:55 +08:00
Kovid Goyal
8280cd4ad0
clipboard: Replace the MIME list PTY test with a Go unit test
Move writing the MIME list into Output.write_mime_list() and test it
directly. Committing, permission preservation and failure cleanup are
already covered by the existing Output commit tests, so the PTY test
that spawned the kitten only added coverage for the missing commit.
2026-10-26 07:50:36 +05:30
Zhizhen He
bb956c7c6b
clipboard: Commit MIME list output when saving to a file 2026-10-26 10:05:45 +08:00
Zhizhen He
7fdd2af0fc
clipboard: Preserve dangling output symlinks 2026-10-25 22:21:52 +05:30
Kovid Goyal
68f242b7d9
clipboard: Cleanup atomic replacement of output files
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.
2026-10-25 20:33:25 +05:30
Zhizhen He
0fae8bb9bd
clipboard: Replace existing output files atomically 2026-10-25 22:40:47 +08:00
Kovid Goyal
d53ad3fd3a
ssh kitten: Resolve HOME when using --symlink-strategy=resolve
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.
2026-10-25 19:09:11 +05:30
Zhizhen He
814e7429ae
ssh: Fix HOME prefix matching for copied paths 2026-10-25 20:54:39 +08:00