Commit graph

1431 commits

Author SHA1 Message Date
newwares
828bd56fa5 ssh kitten: Push and pop keyboard encoding flags 2026-02-07 20:26:28 -05:00
ad-chaos
4897537481 better fix for kitty +lnum path 2026-01-26 15:50:54 +05:30
ad-chaos
17f2d2c574 Revert "Fix edit-in-kitty +lnum path"
This reverts commit 0f80229468.
2026-01-26 14:15:10 +05:30
Kovid Goyal
10273d5aa2
kitten @: Fix relative paths for --password-file being resolved relative to CWD instead of the kitty config directory 2026-01-25 20:30:11 +05:30
Kovid Goyal
75ce50400e
Remote control: scroll-window: Allow fractional scrolling since we now have pixel scroll 2026-01-22 13:05:22 +05:30
phanium
0f80229468 Fix edit-in-kitty +lnum path 2026-01-01 18:28:07 +08:00
Kovid Goyal
e14e34948e
More cleanups for color parsing
Using rounding when converting float to uint8 for more accuracy.
Fix rgb:3 and rgbi: parsing in Go code. Various other minor cleanups.
2025-12-31 09:35:09 +05:30
Kovid Goyal
a4d88beddb
Micro-optimisation 2025-12-30 13:40:49 +05:30
Jökull Sólberg
64abd87a9e Add wide gamut color support with OKLCH and LAB formats
Implements modern wide gamut color formats with CSS Color Module Level 4
gamut mapping, addressing PR feedback with Go implementation, performance
benchmarks, and reorganized documentation.

Features:
- OKLCH (perceptually uniform color space)
- CIE LAB (device-independent color space)
- CSS Color 4 compliant gamut mapping algorithm
- Inline comment support in color config parsing

Addressing PR Feedback:

1. Go Implementation (tools/utils/style/):
   - Complete OKLCH and LAB parsing with gamut mapping
   - Matches Python implementation structure
   - Comprehensive test suite (all tests passing)
   - Performance benchmarks showing acceptable overhead

2. Performance Benchmarks:
   - OKLCH: ~4.6 µs/op
   - LAB: ~1.5 µs/op
   - 10 mixed colors: ~13 µs total
   - Typical config (50 colors): <0.5ms startup impact

3. Documentation Reorganization:
   - Moved detailed color docs to docs/wide-gamut-colors.rst
   - Configuration docs now link to separate documentation
   - Reduces size of main configuration documentation

Gamut Mapping:
- Binary search chroma reduction from CSS Color Module Level 4
- Preserves lightness and hue while reducing chroma for out-of-gamut colors
- Uses deltaE OK (JND threshold: 0.02) for perceptual difference
- Ensures graceful degradation on sRGB displays

Python Implementation:
- parse_oklch(): OKLCH color parsing with gamut mapping
- parse_lab(): CIE LAB parsing with gamut mapping via OKLCH conversion
- lab_to_oklch(): LAB to OKLCH conversion for consistent gamut mapping
- oklch_to_srgb_gamut_map(): CSS Color 4 gamut mapping algorithm
- srgb_to_oklab(): Reverse conversion for deltaE calculations
- deltaE_ok(): Perceptual color difference in OKLab space

Go Implementation:
- colorspaces.go: All color space conversions and gamut mapping
- wrapper.go: ParseColor() updated to support OKLCH and LAB
- Comprehensive test coverage with benchmarks
- Matches Python implementation behavior

Robustness:
- NaN and infinity validation in all color parsing functions
- Defense-in-depth with validation at parsing and gamut mapping levels
- Returns None/error for invalid input (consistent error handling)
- Validates before clamping operations to prevent NaN propagation

Files changed:
- Python: kitty/rgb.py, kitty_tests/datatypes.py (+250 lines)
- Go: tools/utils/style/colorspaces.go, wrapper.go (+350 lines, tests)
- Docs: docs/wide-gamut-colors.rst (moved from inline)
- Config: kitty/options/definition.py (simplified, links to docs)

References:
- CSS Color Module Level 4: https://www.w3.org/TR/css-color-4/
- OKLCH Color Space: https://bottosson.github.io/posts/oklab/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-27 14:34:34 +00:00
Kovid Goyal
f1cc676ea6
... 2025-12-08 20:47:20 +05:30
Kovid Goyal
fee4cb0975
fix warning from linter 2025-12-02 23:37:53 +05:30
Kovid Goyal
f8db2702db
choose files: Add a few more output formats 2025-11-26 21:13:57 +05:30
Kovid Goyal
fae50137a9
Add a clear cache action 2025-11-23 12:15:29 +05:30
Kovid Goyal
6de4e5237f
Resize method should not use bounds 2025-11-17 12:59:04 +05:30
Kovid Goyal
68805850a5
Preserve opacity when resizing on image load 2025-11-15 14:56:21 +05:30
Kovid Goyal
25cf8622bc
Avoid double is_opaque scan 2025-11-15 13:06:17 +05:30
Kovid Goyal
fb6332d8e2
Resize frames in parallel 2025-11-15 12:41:14 +05:30
Kovid Goyal
1d19942811
Store more metadata about pixel data shape when serializing 2025-11-15 12:23:56 +05:30
Kovid Goyal
9bc29a7fa6
Dont write to ~/.gitconfig in the tests
Just in case the tests are run without setting HOME
2025-11-13 18:50:42 +05:30
Kovid Goyal
9be602f94f
... 2025-11-11 21:39:12 +05:30
Kovid Goyal
6f588a0c29
run modernize 2025-11-11 17:09:37 +05:30
Kovid Goyal
d19fc375ba
Switch to external shm package 2025-11-10 12:01:05 +05:30
Kovid Goyal
1c8e8e9530
Switch over to the new imaging backend for icat
Greatly simplifies a whole bunch of code. The new backend takes care of
falling back to ImageMagick efficiently itself.
2025-11-10 11:34:56 +05:30
Kovid Goyal
57f7c8f65e
Bump version of imaging for a few more fixes 2025-11-08 10:27:56 +05:30
Kovid Goyal
375aeae689
Clean up imagemagick disposal processing 2025-11-07 14:44:26 +05:30
Kovid Goyal
f8c78909fa
Use an explicit APNG identifier for apng files with ImageMagick
Required as per Imagemgick docs: https://imagemagick.org/script/formats.php
2025-11-07 11:33:13 +05:30
Kovid Goyal
1e6d67b975
Update to the latest version of imaging
Gives us a bunch of new features and allows us to move a bunch of code
into imaging
2025-11-06 22:31:31 +05:30
Eng Zer Jun
d5455ab072
Update github.com/shirou/gopsutil to v4
v4 is the latest version with bug fixes and enhancements, notably the
removal of CGO implementations on Darwin in v4.24.9 [1].

Note: Due to the library's versioning policy, v4.24.5 is the first v4
release [2].

[1]: https://github.com/shirou/gopsutil/releases/tag/v4.24.9
[2]: https://github.com/shirou/gopsutil/releases/tag/v4.24.5

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2025-10-31 23:14:38 +08:00
Kovid Goyal
1e1a1851d0
Add support for Unicode 17
This is preliminary, all tests pass, but needs more careful review.
2025-10-18 09:59:53 +05:30
Kovid Goyal
1c2c01722b
Bump version of imaging
Fixes an out of bounds error when processing opaque images
2025-10-15 08:29:23 +05:30
Kovid Goyal
284ae74201
icat: Report panics in the render function correctly
Also, only fallback to imagemagick on error when the engine is not
specified as builtin
2025-10-15 08:17:53 +05:30
Kovid Goyal
b627d2e4ab
Move error handling code into its own library 2025-10-12 13:51:16 +05:30
Kovid Goyal
471831831b
move more imaging code into the imaging module 2025-10-12 08:29:30 +05:30
Kovid Goyal
44df0c85c4
Mark the netPBM image types as decodable 2025-10-11 13:43:00 +05:30
Kovid Goyal
a1168be6c7
... 2025-10-11 13:25:46 +05:30
Kovid Goyal
4c0c5c01f2
Bump version of imaging 2025-10-11 13:17:15 +05:30
Kovid Goyal
29e80f2c1b
Remove unused code 2025-10-10 08:23:22 +05:30
Kovid Goyal
b543956638
... 2025-10-09 20:29:15 +05:30
Kovid Goyal
ec7da87905
An endpoint to develop resizing code 2025-10-09 20:09:15 +05:30
Kovid Goyal
436ab9a95a
Add a convenient entry point to test and work on the image serialization code 2025-10-09 19:26:05 +05:30
Kovid Goyal
35093d2105
Fix frame origins not be de-serialized 2025-10-09 19:22:22 +05:30
Kovid Goyal
9212c08638
Faster conversion of plaette to NRGB for opaque colors 2025-10-09 16:57:28 +05:30
Kovid Goyal
2dea3087b3
Faster is_opaque implementation for paletted images 2025-10-09 16:52:13 +05:30
Kovid Goyal
c48ed15007
... 2025-10-09 16:12:39 +05:30
Kovid Goyal
127459012a
Fix incorrect alpha values returned by NRGB color model 2025-10-09 11:39:39 +05:30
Kovid Goyal
298daa4e83
Utility method to save frame as uncompressed PNG 2025-10-09 10:56:33 +05:30
Kovid Goyal
9be66bfe4a
When rendering with Go image libraries fails fallback to ImageMagick 2025-10-09 09:40:46 +05:30
Kovid Goyal
2ac2c17929
Fix transmission by file 2025-10-09 09:35:06 +05:30
Kovid Goyal
c6582e9f51
... 2025-10-09 09:25:47 +05:30
Kovid Goyal
ceb712f791
DRYer 2025-10-09 09:00:37 +05:30
Kovid Goyal
aecf13302a
Fix off-by-one in NRGB 2025-10-09 08:30:20 +05:30
Kovid Goyal
e61e95da3a
... 2025-10-09 08:04:58 +05:30
Kovid Goyal
37bd77f4a8
Bump version of imaging
imaging is now panic safe. Also format nested panics a bit better.
2025-10-09 08:00:31 +05:30
Kovid Goyal
f067e9cd92
Make various goroutines panic-safe 2025-10-09 07:17:53 +05:30
Kovid Goyal
49d8b1a9d0
More work on image preview rendering 2025-10-08 22:00:12 +05:30
Kovid Goyal
c2e75ba466
Fix disk cache not reading inode
Also use a faster atomic update mechanism
2025-10-08 08:35:35 +05:30
Kovid Goyal
16cdcf8cf8
Use inode number and size for more robust entries change tracking 2025-10-08 07:28:02 +05:30
Kovid Goyal
a6335777d9
disk cache: add a path based API
This allows maintaining only a single cache entry per path when the
path's contents change.
2025-10-08 06:41:12 +05:30
Kovid Goyal
a76f32df2d
Code to serialize/unserialize loaded images 2025-10-07 17:25:47 +05:30
Kovid Goyal
1f37f065ab
Improve API of disk cache
Allow getting all keys and also return get result for added keys
2025-10-07 13:01:09 +05:30
Kovid Goyal
224ccb170a
Micro optimisation 2025-10-07 09:23:22 +05:30
Kovid Goyal
328745cad9
removing a non-existent item from disk cache is not an error 2025-10-07 09:16:30 +05:30
Kovid Goyal
5d1ce327e0
Ensure adds to disk cache are atomic 2025-10-07 09:14:14 +05:30
alex-huff
86698e0b17 unicode-input: fix race condition causing incorrect results 2025-10-06 19:14:06 -05:00
Kovid Goyal
ca7ab7a57c
Get rid of os.Exit() from ExecAndHoldTillEnter 2025-09-30 13:25:22 +05:30
Kovid Goyal
712faa7aa5
Fix pruning on DiskCache object creation 2025-09-30 13:18:00 +05:30
Kovid Goyal
8fdbf8d7da
Make the paths returned by DiskCache stable even if the parent entry is removed/pruned for the life of the process 2025-09-30 12:53:08 +05:30
Kovid Goyal
16d411943a
Add integration test for go atexit implementation 2025-09-30 12:37:25 +05:30
Kovid Goyal
190e3e5891
Add atexit cleanup via worker process to kittens infrastructure 2025-09-30 11:52:13 +05:30
Kovid Goyal
4f9519d773
Cleanup __atexit__ 2025-09-30 11:29:49 +05:30
Kovid Goyal
ba96fa06fe
Allow using defer in KittenMain 2025-09-30 11:20:37 +05:30
Kovid Goyal
ca0ff68d8e
More tests for disk cache 2025-09-30 11:16:49 +05:30
Kovid Goyal
d7199f1f75
Start working on tests for disk cache 2025-09-28 21:35:36 +05:30
Kovid Goyal
30f7ed76c1
Start work on disk cache for choose files preview caching 2025-09-28 09:49:16 +05:30
Kovid Goyal
ee00bfa01a
... 2025-09-21 10:15:06 +05:30
Kovid Goyal
f98d5fce16
Remove multiple copies of imaging package
Move to an exiffix fork that does not depend on disintegration/imaging
Now we have only one copy of kovidgoyal/imaging package.
2025-09-19 21:41:23 +05:30
Kovid Goyal
80260e6eb1
Move back to individual settings for scrollbar
We need to split out the color settings so that they can be set in
themes anyway, so ...
2025-09-14 17:48:59 +05:30
Kovid Goyal
a28e9a0146
Fix infinite recursion in readline completer 2025-08-16 06:55:39 +05:30
Kovid Goyal
fd5876b94e
Use SIMD to replace C0 control codes in Go code 2025-07-21 08:54:22 +05:30
Kovid Goyal
bd0f55531f
Implement previews for plain text files 2025-07-20 19:24:17 +05:30
Kovid Goyal
28fce006d6
Make highlight code fully re-useable 2025-07-20 15:37:03 +05:30
Kovid Goyal
2bdbbd909c
Handle color scheme changes in choose-files kitten 2025-07-20 13:43:59 +05:30
Kovid Goyal
063cf243c1
add cursor_trail_color to nullable_colors and all_color_settings 2025-07-19 07:03:13 +05:30
Kovid Goyal
94e6f240a6
Allow running python kittens via the kitten binary
It just delegates to kitty +kitten automatically
2025-07-15 14:36:19 +05:30
Kovid Goyal
4d3bbd82e0
Extend the SGR Pixel mouse reporting protocol to also report when the mouse leaves the window 2025-07-12 11:59:23 +05:30
Kovid Goyal
d22244d135
Micro-optimization 2025-07-12 09:22:27 +05:30
Kovid Goyal
fef57bd4c2
Format counts using user locale 2025-07-12 08:24:06 +05:30
Kovid Goyal
697805765e
... 2025-07-10 08:20:16 +05:30
Kovid Goyal
ecf4ef396b
Add a test for getting the global git config excludesfile value 2025-07-09 14:44:57 +05:30
Kovid Goyal
f742009c55
Ensure global gitignore file is not loaded in tests 2025-07-09 14:31:46 +05:30
Kovid Goyal
351275cb8c
Work on adding ignorefiles support to choose-files 2025-07-09 11:54:43 +05:30
Kovid Goyal
c346735c74
Finish up gitignore implementation 2025-07-08 12:03:58 +05:30
Kovid Goyal
4383398f25
Fix ** matching 2025-07-08 10:02:43 +05:30
Kovid Goyal
bde347457c
Start work on gitignore parsing 2025-07-08 09:43:50 +05:30
Kovid Goyal
ebe9842291
Implement file filters via dbus 2025-07-06 12:17:09 +05:30
Kovid Goyal
0a9d83e11b
Allow more sophisticated event tracking for hover regions 2025-07-05 13:04:43 +05:30
Kovid Goyal
fdf0a13687
Change mouse pointer shape over input area 2025-07-05 12:23:44 +05:30
Kovid Goyal
834d0d3848
Make the filter labels clickable 2025-07-05 11:37:17 +05:30
Kovid Goyal
76d0991b76
Work on filter support 2025-07-04 13:37:56 +05:30
Kovid Goyal
d5534b6238
Add conf file for desktop-ui kitten 2025-07-01 13:26:39 +05:30
Kovid Goyal
461e63049a
Fix #8754 2025-06-26 21:30:43 +05:30
Kovid Goyal
324b95f825
Fix recursion into symlinks to dirs 2025-06-25 08:35:38 +05:30
Kovid Goyal
4a13c53438
Turn off focus tracking while doing tty remote control
Fixes #8733
2025-06-16 21:57:19 +05:30
Kovid Goyal
dea6e1da42
Special case parallel run with one worker 2025-06-06 16:02:31 +05:30
Kovid Goyal
5e6d4ea4c0
... 2025-06-06 13:32:46 +05:30
Kovid Goyal
7029a35df9
Port subseq tests to fzf 2025-06-06 13:28:58 +05:30
Kovid Goyal
ed45e1354b
Work on implementing the fzf algorithm for the choose files kitten
People are more used to that, and it is more optimized for use case of
finding files.
2025-06-06 12:29:35 +05:30
Kovid Goyal
3059c87bd0
Use a lock and channel free parallelization for subseq scoring 2025-06-06 06:39:09 +05:30
Kovid Goyal
3feea5b279
DRYer 2025-06-05 20:59:09 +05:30
Kovid Goyal
6880ecaa28
Work on save file name mode 2025-06-03 20:27:14 +05:30
Kovid Goyal
bd2d15406a
Use a better icon for home folder in results title 2025-06-01 13:20:38 +05:30
Kovid Goyal
7657b2b8c6
Get correct stacktraces for goroutine panics 2025-06-01 13:07:11 +05:30
Kovid Goyal
d1faccdd1c
Loop API print proper stack traces for panics in go routines 2025-06-01 12:51:59 +05:30
Kovid Goyal
ecb9c46b95
... 2025-06-01 12:35:23 +05:30
Kovid Goyal
b784dd4fba
Sort the lists 2025-05-21 22:40:55 +05:30
Kovid Goyal
f0537198e6
... 2025-05-21 22:29:05 +05:30
Kovid Goyal
646bf47a43
Icons for file matches 2025-05-21 22:16:22 +05:30
Kovid Goyal
ad03fa94b2
Update the list of nerd font names when updating other unicode data as well
No longer need to store the list of names in our source code
2025-05-21 13:19:27 +05:30
Kovid Goyal
cc500893f0
... 2025-05-21 12:16:25 +05:30
Kovid Goyal
b55013944e
More work on choose-files 2025-05-20 14:16:49 +05:30
Kovid Goyal
fbfdb38260
Start work on choose files kitten 2025-05-20 12:32:43 +05:30
Kovid Goyal
c94844b220
Start work on Linux desktop portal kitten 2025-05-19 08:52:18 +05:30
Kovid Goyal
e015ebefab
Implement focus tracking in kitten infrastructure 2025-05-16 12:48:21 +05:30
Kovid Goyal
4713cc29ad
make gofmt happy 2025-05-16 09:40:34 +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
429cff0a52
Convenience method to access any member of a set 2025-05-15 21:40:06 +05:30
Kovid Goyal
7ec0085a0b
Also report panic via debugprintln 2025-05-14 12:06:01 +05:30
Kovid Goyal
123a115836
Make kitten main re-useable 2025-05-13 18:51:49 +05:30
Kovid Goyal
6a53897c17
change_font_size: allow multiplying/dividing the current font size in addition to incrementing it
Fixes #8616
2025-05-09 07:39:06 +05:30
Kovid Goyal
5683314784
Start work on quick-access-terminal kitten 2025-04-28 19:52:04 +05:30
Kovid Goyal
9854068a59
Start work on panel kitten wrapper in Go
Needed because we need to use a special exe on macOS.
2025-04-28 16:07:09 +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
17876385c5
... 2025-04-23 18:52:40 +05:30
Kovid Goyal
796ee602de
... 2025-04-21 09:50:30 +05:30
Kovid Goyal
6f673929eb
Fix failure of tarfile extract when dest_path has symlinks 2025-04-21 09:46:30 +05:30
Kovid Goyal
4d69eea4af
Add test for tarfile extractall 2025-04-21 09:32:56 +05:30
Kovid Goyal
3daac6fb22
Remove unnecessary check 2025-04-20 23:38:16 +05:30
Kovid Goyal
50b830faa5
DRYer 2025-04-20 23:18:49 +05:30
Kovid Goyal
5a6c2d9f3b
skip illegal paths in tar archives rather than erroring on them 2025-04-20 23:12:17 +05:30
Kovid Goyal
d7f4d44d8e
More CodeQL fixes 2025-04-20 23:08:14 +05:30
Kovid Goyal
341df0dccb
More CodeQL fixes 2025-04-20 22:13:45 +05:30
Kovid Goyal
237bb35ee9
More CodeQL fixes 2025-04-20 21:53:11 +05:30
Kovid Goyal
adfcffa5d7
Various fixes to make CodeQL happy 2025-04-20 21:34:42 +05:30
Kovid Goyal
c84b894a89
Remove deprecated tar file type check 2025-04-20 15:59:20 +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