Commit graph

163 commits

Author SHA1 Message Date
Kovid Goyal
add52d9cf7
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
Normalise the cwd passed to CompleteFiles once, so that a relative cwd,
such as a config directory from a relative XDG_CONFIG_HOME, no longer gets
joined onto itself twice. This also removes the second resolution pass
against cwd and the absolutize_path helper. Check for errors in the test
setup and test relative, ../ and ~/ prefixes against a custom cwd as well
as a relative cwd.
2026-11-14 08:29:17 +05:30
devangpratap
30e7f3512e Complete paths relative to the config directory correctly
CompleteFiles resolved the prefix with filepath.Abs, which uses the
process cwd, instead of the cwd it was given. For the completers that are
relative to the config directory, like kitty --session and launch
--watcher, a prefix such as sessions/ was looked up under the shell's cwd,
so completing inside a sub-directory of the config directory gave nothing,
or the contents of a same named directory in the shell's cwd. Resolve
relative prefixes against the given cwd instead.
2026-11-12 16:40:55 -05:00
Kovid Goyal
02dd29ad14
Add nightly version to version string for nightly builds. Fixes #10751 2026-10-27 10:43:51 +05:30
Kovid Goyal
52d33e2c82
zsh completion: Respect the descriptions format style for group headings
Previously group headings were hard-coded as %B<title>%b, ignoring the
user's zstyle ':completion:*:descriptions' format. This caused literal
%B/%b markers to appear with fzf-tab. Now the configured format is used,
falling back to bold titles when none is set.

Fixes #10748
2026-10-26 16:31:39 +05:30
Hassan Raza
a77b763960
Cover missing values after grouped and repeated options 2026-10-18 11:47:32 +05:00
Hassan Raza
608e46be33
Reject options whose required value is missing 2026-10-18 11:46:17 +05:00
Hassan Raza
b1df817c44
Cover missing values on CLI option aliases 2026-10-18 11:45:33 +05:00
devangpratap
bd3eb4c267 Completion: Do not emit multi line candidates for fish
fish splits the output of the completion function on newlines to build
the candidate list, so an option whose help text spans paragraphs added
its continuation lines as candidates of their own. Build the candidate
with the newline replacement the fish2 branch already used, so both
paths agree.
2026-09-24 14:48:28 -04:00
devangpratap
62a4b451d4 Do not offer symlinks to directories as executables in completion
CompleteExecutablesInPath excluded directories with e.IsDir(), but that is false
for a symlink pointing at a directory. Directories are executable in the
access(2) sense, so such a symlink sitting in a PATH entry passed the X_OK check
and was offered as a command. Use the existing is_dir_or_symlink_to_dir helper,
which already makes this distinction elsewhere in the file.
2026-09-16 20:17:32 -04:00
devangpratap
579c735014 Use GuessMimeType for mime based completion
complete_by_mimepat called mime.TypeByExtension directly, so it saw only the
extensions the Go standard library knows about. Everything else in kitty that
needs a mime type goes through utils.GuessMimeType, which also consults the
user's mime.types, kitty's builtin types and KnownExtensions. As a result
files like foo.py or foo.toml were not offered when completing arguments that
ask for text/*, even though kitten pager opens them as text.
2026-09-16 05:43:17 -04:00
devangpratap
ebb41b83da Fix completion of directories containing files with uppercase extensions
Completion patterns are lowercased in make_completer and file names are
lowercased before being matched against them, but the names of files inside
a directory were passed to the matcher unchanged. A directory whose only
matching file was named something like B.CONF was therefore never offered as
a completion candidate for a *.conf pattern, while the same file named
b.conf worked.
2026-09-16 00:43:53 -04:00
devangpratap
04082039be Fix completion of symlinks to directories for directory arguments 2026-09-15 14:09:41 -04:00
devangpratap
fd904d45d8 Fix completion of paths directly under the root directory 2026-09-15 11:15:04 -04:00
Kovid Goyal
26fa4b557d
bash completion: Dont remove common prefix. Fixes #10388 2026-08-23 08:36:58 +05:30
Xuyiyang23333
c0661024d8 Fix silent failure when pager (less) is not installed
When kitten --help is run in a terminal and less is not available,
ShowHelpInPager silently discards the error from pager.Run(), resulting
in no output and a zero exit code. Fall back to writing help text
directly to stdout when the pager fails, matching the behavior of the
Python equivalent in kitty/cli.py which catches FileNotFoundError and
prints the text as a fallback.

Signed-off-by: Xuyiyang23333 <xuyiyang23333@gmail.com>
2026-05-13 00:37:55 +08:00
Kovid Goyal
eddaaed3e3
Modernize Go code 2026-03-21 08:41:47 +05:30
Kovid Goyal
f1cc676ea6
... 2025-12-08 20:47:20 +05:30
Kovid Goyal
6f588a0c29
run modernize 2025-11-11 17:09:37 +05:30
Kovid Goyal
ba96fa06fe
Allow using defer in KittenMain 2025-09-30 11:20:37 +05:30
Kovid Goyal
697805765e
... 2025-07-10 08:20:16 +05:30
Kovid Goyal
d5534b6238
Add conf file for desktop-ui kitten 2025-07-01 13:26:39 +05:30
Kovid Goyal
c861259e3b
Rename go module from kitty -> github.com/kovidgoyal/kitty
Makes the code more easily re-useable in other projects
2025-05-16 08:43:39 +05:30
Kovid Goyal
5683314784
Start work on quick-access-terminal kitten 2025-04-28 19:52:04 +05:30
Kovid Goyal
d7fb143ee0
Allow explicitly setting boolean options in Go cli parser
Matches C parser
2025-04-28 11:54:51 +05:30
Kovid Goyal
39bf612071
DRYer 2025-04-28 11:33:58 +05:30
Kovid Goyal
92c6d90132
Allow single char options to take =value in kittens
Matches kitty cli parsing behavior
2025-04-28 11:27:33 +05:30
Kovid Goyal
ba46678a0d
Fix width test kitten descriptive text being erased 2025-04-12 15:20:07 +05:30
Kovid Goyal
357481900d
Add combining at line end test 2025-04-11 13:16:45 +05:30
Kovid Goyal
ed719d91ec
... 2025-04-11 12:24:46 +05:30
Kovid Goyal
cd4490b5ad
Test cursor position after individual graphemes 2025-04-11 12:21:40 +05:30
Kovid Goyal
66a2702631
... 2025-04-11 12:08:42 +05:30
Kovid Goyal
dbc88d8a3a
Document test description format 2025-04-11 12:03:06 +05:30
Kovid Goyal
342ac57e63
Allow restricting the tests run 2025-04-11 11:40:23 +05:30
Kovid Goyal
3a4d32b85b
Get basic full string width tests running 2025-04-11 10:45:39 +05:30
Kovid Goyal
cf6bb29ef7
Start work on width testing kitten 2025-04-11 09:34:21 +05:30
Kovid Goyal
38a2c6eab0
Cleanup previous PR 2025-04-05 09:22:10 +05:30
3pleX-dev
1d93982424 fix reproducibility issues 2025-04-05 01:27:23 +01:00
Koichi Murase
8a1f829653 Call _command_offset from bash-completion framework only if available 2024-10-14 15:40:43 +09:00
Kovid Goyal
405f5ce148
Use stdlib maps/slices 2024-06-24 07:54:13 +05:30
Kovid Goyal
58dbcf0840
... 2024-02-25 09:57:36 +05:30
Kovid Goyal
70bc4f1033
Generate man pages for kitten and all its sub-commands recursively
Fixes #6808
2023-11-11 17:09:23 +05:30
Kovid Goyal
65754a2032
... 2023-11-11 08:45:39 +05:30
Kovid Goyal
455d0a6048
Dont show hidden sub-commands during completion 2023-10-10 05:41:27 +05:30
Kovid Goyal
5d0dabe51c
completion: match exe on basename alone 2023-10-10 05:22:40 +05:30
Eng Zer Jun
77563cebb0
cli/command: remove redundant nil check
From the Go specification:

  "1. For a nil slice, the number of iterations is 0." [1]

Therefore, an additional nil check for before the loop is unnecessary.

[1]: https://go.dev/ref/spec#For_range

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-08-30 11:50:52 +08:00
Kovid Goyal
a3369465dc
Remove unused code 2023-08-05 10:11:15 +05:30
Kovid Goyal
341d845b9a
Port calls to slices.Sort functions since they now need a cmp() function rather than a less() function
Also rename os.SEEK_* to io.Seek* as the former has been deprecated
2023-08-04 22:50:13 +05:30
Kovid Goyal
ffd997c338
Detect prompt lines in code blocks 2023-07-30 19:49:47 +05:30
Kovid Goyal
38666f978b
More work on porting transfer kitten 2023-07-30 19:49:39 +05:30
Kovid Goyal
ab10070ee8
kittens: Fix errors not being reported to user when run a UI kitten
Fixes #6403
2023-06-29 07:36:24 +05:30