Commit graph

1736 commits

Author SHA1 Message Date
Kovid Goyal
2bab3ccb18
macOS specific changes for wheel events PR 2026-10-12 12:37:58 +05:30
Kovid Goyal
e0382c0138
mouse_map: Allow mapping horizontal scrolling with wheel_left and wheel_right
Both axes of a scroll event are dispatched, so a diagonal gesture can fire
both, and the event is consumed if either axis is mapped. An unmapped event
continues a mapped gesture only if it scrolls along axes without any mappings.
2026-10-12 11:25:25 +05:30
Kovid Goyal
2d57c2201d
Cleanup previous PR
- Only call into Python for scroll events when the wheel is mapped for the
  current modifiers and mode, using a bitmap of wheel mappings built in
  set_options(), and only when a step completes
- Do not swallow the momentum of an unmapped gesture that follows a mapped one
- Do not carry a partial step over to a different window or modifiers or
  across unmapped scrolling
- Count wheel steps without relying on the mouse tracking mode semantics of
  scale_scroll()
- Return the result of the mapped actions from on_mouse_event()
- Ignore mouse_selection for the wheel, it would never be released
- Add integration tests for scrolling with wheel mappings
2026-10-12 11:06:32 +05:30
Kovid Goyal
0ae80efa10
Merge PR #10590: Allow mapping the scroll wheel with mouse_map
# Conflicts:
#	docs/changelog.rst
2026-10-12 11:00:08 +05:30
Jesse Miller
c57495436d Skip foreground samples for blank cells
The cell fragment shader sampled the glyph, underline, strike, cursor, and underline-exclusion texels for every cell. A space is sprite 0, and that sprite is empty, so those samples add nothing. The vertex shader now sets skip_text when the glyph, both decoration indices, and the cursor sprite are all zero. The fragment writes the background it already computed and skips the samples. A block cursor is sprite 0, so its color stays in the background. An underline, strike, URL underline, or beam, underline, or hollow cursor still samples. The foreground-only pass writes zero for a skipped cell.

On Linux, platform text composition is gamma 1 and contrast 0, which is pow(alpha, 1) * 1. TEXT_CONTRAST_IDENTITY compiles that function down to returning the color unchanged. legacy and any other numbers keep the old math. A config reload that crosses that line rebuilds the cell programs. The identity flag is only varied when the new gamma path is on, so the cell programs go from 18 to 27.
2026-10-11 10:38:17 -06:00
Petr Vanc
b04e90ddaf
scrollwheel working: tested on laptop touchpad, old mouse wheel, new mouse wheel (MX Logi). Not tested on MacOS. 2026-10-10 13:53:39 +02:00
Kovid Goyal
42eb2a1c3b
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
- Anchor the IME cursor rectangle at the column the pre-edit text is
  actually drawn at, which is shifted left of the cursor when the text
  would not otherwise fit on the line, instead of at the cursor column.
- Store the IBus cursor geometry cache per input context rather than in
  a function static, only update it after a successful send and reset it
  whenever a new input context is created.
- Add a test and a changelog entry.
2026-10-10 12:45:19 +05:30
Kovid Goyal
be4fef614b
Custom shaders: Query shader source with a parser instead of regexes
Add a small Slang lexer and top level declaration parser to slang.py, and
SlangShaderQuery which runs the slangc preprocessor when an answer could
depend on it. Use it for:

- Detecting pointer_map(), so that comments, #if 0 blocks and calls no
  longer count, macros are honored, and a pointer_map() that is not public
  or does not return float2 is reported instead of failing obscurely. The
  result is cached alongside the pipeline module, so a cached load does
  not run slangc.
- Applying pipeline var directives, which now work for declarations
  spanning multiple lines and match by name as documented.
- Parsing the builtin shaders, with identical results for all of them.

Also cleanup minor issues form previous PR

- Ignore pointer_map() in groups that only draw to part of the screen
- Share the pointer position conversion between glfw.c and mouse.c
- Pass POINTER_MAP_SIZE to the pipeline as a define instead of
  duplicating it
- Do not free the pointer map render target on every pipeline reload
- Document what pointer_map() may depend on and when d.mouse_pos lines
  up with the pointer
2026-10-10 11:04:08 +05:30
Kovid Goyal
c75ed19448 Merge PR #10639: Custom shaders: Allow shaders that move content to remap pointer events 2026-10-10 10:41:39 +05:30
Kovid Goyal
c53ef1048a
Fix #10627 2026-10-10 10:05:17 +05:30
Kovid Goyal
0e408d502a
Speed up laying out the horizontal tab bar
Laying out the tab bar draws each tab several times, so cache evaluated
title templates for the duration of a single update, unless the template
depends on the length available for the title. Also skip measuring the
overhang of truncated tabs once there is no free space left, as then it
cannot change the layout.
2026-10-10 09:03:43 +05:30
Kovid Goyal
1576898315
Cleanup previous PR
Leave custom draw_tab functions a cell of slack per truncated tab, as
their overhang may grow with the space they are given. Add fade style
tests and a shared helper for horizontal tab bar tests.
2026-10-10 09:03:28 +05:30
Alistair Pattison
094b1a66a5 use all free space in the tab bar for truncated tab titles 2026-10-09 19:59:40 -04:00
Iurii Lunev
30e07a5b09 Custom shaders: Allow shaders that move content to remap pointer events
A shader that draws content away from where kitty put it, such as crt
curving the screen, makes clicks and selections land on the wrong cells,
since kitty maps the pointer to the unmodified cell grid. Up to several
columns near the edges with the bundled crt shader.

Shaders can now define pointer_map(pos, d), returning where the content
shown at pos actually is. kitty renders it into a 64x64 grid when the
pipeline or viewport size changes, reads it back once, and uses it to
move all pointer events. Only always active groups that draw to the
screen are used, since only they move content permanently.

The crt shader defines it, sharing its warp function with fragment_main().
2026-10-09 23:31:29 +03:00
Kovid Goyal
c406b136cb
Cleanup previous PR
- Only restore entry sizes in the Splits layout resize mode was opened in;
  otherwise fall back to the default reset rather than refusing to reset
- Do not take a snapshot lazily from already resized sizes when resize mode
  was opened in another layout
- Running the resize kitten while its overlay is open replaces the overlay so
  the new options take effect, keeping the original-size snapshot
- Newer edge statuses replace older local messages, and edge failures beep
- Switching strategy no longer discards a --fraction command-line override
- Compute divider room without deep copying the pair subtree
- Fractional resize in other layouts adopts the probed state instead of
  replaying every step
2026-10-09 19:51:38 +05:30
Kovid Goyal
bbe1f53bd6 Merge branch 'pr-10636' 2026-10-09 19:42:48 +05:30
Kovid Goyal
e55d14085a
Cleanup previous PR
- Parse in-band resize reports robustly: require the 48; prefix, accept
  extra parameters and reject negative values instead of panicking
- Handle bracketed paste in parse_input_from_terminal with a dedicated
  scan for the end of paste marker so pasted escape bytes are never lost
- Guard against NaN in scroll_by_pixels and scroll_to_absolute, clamp
  negative absolute scroll targets, let infinite fractional scrolls clamp
  and propagate overflow errors from PyLong_AsDouble
- Empty disk cache entries no longer claim offset 0 in the cache file and
  defrag only moves entries actually written to disk
- Reject zero and too large block sizes in rsync signature headers
- Only replace the encryptor tag once it has been read successfully
2026-10-09 18:37:48 +05:30
白鸽
3e0d7b5dbd Format resize remote command and entry tests for CI 2026-10-09 20:34:02 +08:00
白鸽
c317e0f1be Restore entry proportions in both Splits resize strategies 2026-10-09 20:05:51 +08:00
白鸽
eeae762225 Add explicit edge resizing for Splits and preserve resize sessions 2026-10-09 19:54:02 +08:00
白鸽
ee7d3d604b Add configurable fractional steps to window resizing 2026-10-09 19:54:02 +08:00
rudolf-blue
390cfc7862 Fix leak of AES256GCMDecrypt object when the tag is too short 2026-10-09 07:40:56 -04:00
rudolf-blue
72da47342f Reject out of range width and height in png_from_32bit_rgba_data 2026-10-09 07:40:55 -04:00
rudolf-blue
307561bb3e End bracketed paste in kittens even inside an unterminated sequence 2026-10-09 07:40:55 -04:00
rudolf-blue
ee56934397 Forget the disk position of a replaced zero length cache entry 2026-10-09 07:40:55 -04:00
rudolf-blue
74fd8e792f Ignore fractional scroll amounts that are not finite 2026-10-09 07:40:55 -04:00
Kovid Goyal
f78106e296
Cleanup previous PR
- Back off on all accept() errors that leave the connection pending, not
  just resource exhaustion, so the talk thread cannot spin on a readable
  listener
- Use an atomic for the test only accept failure injection instead of
  taking the talk mutex on every accept
- Encrypt disk cache entries in chunks of up to 1MB to reduce the number
  of write syscalls for large images
- Have GlobalWatchers.set_extra() invalidate the cached watchers
2026-10-09 11:14:45 +05:30
Kovid Goyal
26de0a5d11 Merge branch 'more-fixes' of https://github.com/rudolf-blue/kitty
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:09:49 +05:30
Kovid Goyal
0607401967
Make history consumption on resize an explicit parameter
resize_screen_buffers() moves the storage of the source history buffer into
the result, both when reusing unchanged lines and in the same size fast path.
Replace the global used to opt out of this with an explicit HistoryResizeMode
argument so callers that must keep their history (HistoryBuf.rewrap) state it,
and make the same size fast path copy rather than steal in that mode. Document
that nothing may fail after the history has been consumed.
2026-10-09 10:49:57 +05:30
rudolf-blue
96f728cc82 Avoid copying the scrollback on height only resizes 2026-10-09 00:01:01 -04:00
rudolf-blue
68bc11d2ce Fix continued line detection once scrollback has wrapped around 2026-10-09 00:01:01 -04:00
rudolf-blue
1adf1fbb76 Use a per instance cache for resolved action aliases 2026-10-09 00:01:01 -04:00
rudolf-blue
b9b7e0b29c Stop the talk thread from blocking on peer sockets 2026-10-08 23:59:57 -04:00
rudolf-blue
806c86b9b3 Keep the talk thread running after transient accept() errors 2026-10-08 23:59:57 -04:00
rudolf-blue
d1730b7eaa Clear global watchers when removed from config on reload 2026-10-08 23:59:57 -04:00
rudolf-blue
e6423bc05c Fix spacing edges in serialized launch args 2026-10-08 23:59:57 -04:00
rudolf-blue
2dc9687573 Fix deleting displayed and base animation frames 2026-10-08 23:59:57 -04:00
rudolf-blue
8637b48ad2 Fix escape handling in parse_input_from_terminal 2026-10-08 23:59:57 -04:00
rudolf-blue
37bfa25d0e Fix fractional scroll losing sub-line pixel remainders 2026-10-08 23:59:57 -04:00
rudolf-blue
fc63c2590f Fix off by one continued flag in dump_lines_with_attrs 2026-10-08 23:59:57 -04:00
rudolf-blue
f16d09603e Allow 16 entries on the pointer shape stack 2026-10-08 23:59:57 -04:00
rudolf-blue
d2a272bb98 Fix dotted and dashed underline SGR in as_ansi output 2026-10-08 23:59:57 -04:00
rudolf-blue
f7441cc323 Fix parsing of rgbi colors 2026-10-08 23:59:57 -04:00
rudolf-blue
9952b8275c Fix render_decoration raising KeyError for known decorations 2026-10-08 23:59:57 -04:00
rudolf-blue
518552241f Show the spec in the invalid font feature error 2026-10-08 23:59:57 -04:00
rudolf-blue
5f75c46ae5 Encrypt disk cache entries outside the lock 2026-10-08 23:59:56 -04:00
rudolf-blue
f3b74cdeac Fix key leak and stale entry accounting in disk cache defrag 2026-10-08 23:59:56 -04:00
rudolf-blue
9cfd91e812 Fix crash in png_from_32bit_rgba_data on invalid input 2026-10-08 23:59:56 -04:00
rudolf-blue
a24311b240 Stop CHT once the cursor reaches the last column 2026-10-08 23:59:56 -04:00
rudolf-blue
3d007dbf9e Fix out of bounds write in single line DECCARA 2026-10-08 23:59:56 -04:00