Commit graph

414 commits

Author SHA1 Message Date
Kovid Goyal
da590ed5ec
Remove unused code 2026-05-03 11:57:33 +05:30
Kovid Goyal
ff7c6425e6
More work on dnd kitten 2026-05-02 12:16:42 +05:30
copilot-swe-agent[bot]
3f04b4dd40
Remove spurious blank line in Decoder Finish method
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/cb72bac9-aa33-480e-83e9-2f59508694a7

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-02 03:23:18 +00:00
copilot-swe-agent[bot]
ef8189016f
Add streaming base64 encoder with comprehensive tests
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/cb72bac9-aa33-480e-83e9-2f59508694a7

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-02 03:21:25 +00:00
copilot-swe-agent[bot]
7757d160bc
RemoveChildren: use RefCountedFile instead of DupFile, skip seek for child dirs
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/e648c02e-d4cc-4f6c-8188-17941e8a1dd8

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-27 04:01:02 +00:00
copilot-swe-agent[bot]
708cff7f4b
Convert RemoveChildren from recursive to iterative stack-based
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/bd5ca209-e811-4c49-bec7-5dd3a40d8c57

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-27 03:50:32 +00:00
Kovid Goyal
c655df1c2d
... 2026-04-27 09:12:43 +05:30
Kovid Goyal
9e59bf2f6a
Avoid extra lstat() per entry when removing directory tree 2026-04-27 09:09:07 +05:30
copilot-swe-agent[bot]
cca16aabd3
Add tests for RenameAt, find_overwrites, and rename_contents
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/2fffdd1f-2d67-4a28-b124-437c26794e25

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-27 03:02:32 +00:00
Kovid Goyal
8c2c32a5a5
More work on the dnd kitten 2026-04-27 08:22:17 +05:30
Kovid Goyal
151fb9220f
More work on dnd kitten 2026-04-26 20:45:41 +05:30
Kovid Goyal
ff560f615e
... 2026-04-26 13:15:08 +05:30
copilot-swe-agent[bot]
6000226cdf
Add tests for file_at_fd.go and fix FD lifetime bug in CopyFolderContents
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/389bb81e-e9f9-4428-a79a-d8d461cfe943

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-25 11:30:59 +00:00
Kovid Goyal
a5940b4eb1
... 2026-04-25 13:59:37 +05:30
Kovid Goyal
ecc241d891
For for background copy go routine to exit 2026-04-25 13:40:58 +05:30
Kovid Goyal
f6c0955e84
Read large directories in chunks for faster cancel 2026-04-25 13:34:21 +05:30
Kovid Goyal
a6e58e2ca9
Cleanup symlink seen handling 2026-04-25 13:25:33 +05:30
Kovid Goyal
5146cb388b
Fix various minor bugs in copy folders 2026-04-25 13:02:27 +05:30
Kovid Goyal
8737da510f
Add optional symlink following to copyfolder function 2026-04-25 12:08:56 +05:30
Kovid Goyal
4a5ab0a05e
Fix various minor bugs in the copy folders function 2026-04-24 15:35:44 +05:30
Kovid Goyal
68a4623f37
DRYer 2026-04-24 15:12:24 +05:30
Kovid Goyal
55c4519707
More pointless UNIX variability 2026-04-24 14:56:29 +05:30
Kovid Goyal
0f81bca430
DRYer 2026-04-24 14:37:34 +05:30
Kovid Goyal
ca7388c145
Bloody lazy Crapple
No mknodat. Sigh.
2026-04-24 14:22:41 +05:30
Kovid Goyal
2c37fb4845
API to copy folder contents using dir fds
Also make the various fd based wrappers handle EINTR automatically.
2026-04-24 14:12:04 +05:30
Kovid Goyal
ddcf471d90
rename file 2026-04-24 14:11:32 +05:30
Kovid Goyal
64342abda0
More work on the dnd kitten 2026-04-23 08:15:34 +05:30
Kovid Goyal
b4f7162a73
Use CLOEXEC with openat 2026-04-21 22:01:39 +05:30
Kovid Goyal
43035b7224
Rename at fd module 2026-04-21 21:59:05 +05:30
Kovid Goyal
828384a324
More fd based API 2026-04-21 21:58:33 +05:30
Kovid Goyal
b8de27655f
Utility function to delete content of dir pointed to by open file 2026-04-21 21:41:17 +05:30
Kovid Goyal
1ca6dba7e1
... 2026-04-21 13:12:45 +05:30
Kovid Goyal
3d8a2fbb4f
Use SIMD base64 everywhere 2026-04-21 11:56:55 +05:30
Kovid Goyal
744ad7438c
Use SIMD base64 encoding for graphics transmission 2026-04-21 10:01:28 +05:30
Kovid Goyal
93573aec6f
Switch to SIMD based base64 decoder 2026-04-21 09:52:39 +05:30
Kovid Goyal
1b741ca725
Clean up API of streaming decoder 2026-04-21 09:49:09 +05:30
copilot-swe-agent[bot]
7b346d15c1
Add comprehensive tests for streaming_base64 decoder
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/b5dbc339-6907-46fb-a7e7-9ee08b7ed20d

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-21 04:13:30 +00:00
Kovid Goyal
94651eaff2
Go version of streaming base64 decoder 2026-04-21 09:34:25 +05:30
Kovid Goyal
59cf34ca58
Get machine_id working on macOS as well 2026-04-12 12:31:42 +05:30
Kovid Goyal
950497ac0c
Cleanup previous PR 2026-04-03 22:25:05 +05:30
z3rco
b39f88c6a2 Fix multiple security vulnerabilities across C, Python, and Go code
Timing-safe comparisons:
- crypto.c: Replace memcmp with CRYPTO_memcmp for Secret equality,
  require equal lengths before comparing
- remote_control.py: Constant-time password lookup to avoid leaking
  valid passwords via dict hash timing
- file_transmission.py: Use hmac.compare_digest for bypass token
  comparison instead of ==

Memory safety:
- child-monitor.c: Fix inverted condition in write_to_peer that
  prevented memmove from ever executing on partial writes
- ibus_glfw.c: Null-terminate IBUS_ADDRESS copy to prevent string
  overread when strlen >= PATH_MAX
- x11_window.c: Add NULL checks after realloc in clipboard/DnD
  data handling (two sites)
- dnd.c: Cap accepted_mimes at 1MB to prevent unbounded growth,
  fix realloc to not lose the original pointer on failure
- png-reader.c: Cast to size_t before multiplication to prevent
  integer overflow on 32-bit platforms

Secrets hygiene:
- disk-cache.c: Zero encryption_key with explicit_bzero before free

Tar extraction hardening:
- tar.go: Validate hardlink targets against destination prefix to
  prevent writing outside extraction directory
- tar.go: Strip setuid/setgid/sticky bits from extracted files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 16:10:46 +01:00
Kovid Goyal
eddaaed3e3
Modernize Go code 2026-03-21 08:41:47 +05:30
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
f8db2702db
choose files: Add a few more output formats 2025-11-26 21:13:57 +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