Commit graph

188 commits

Author SHA1 Message Date
Kovid Goyal
9cd2c60064
Clean previous PR
Some checks are pending
CI / Linux (python=3.13 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.11 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.12 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-06-29 06:17:08 +05:30
amoena
207b22aa80
fix(erase_last_command): erase the most recent command even empty output
erase_last_command selected the region to erase via find_cmd_output(..., -1),
which anchors on OUTPUT_START (OSC, 133;C). Commands that produce no output
(an empty Enter, a comment, cd, export, etc. -- never emit 133;C, so they were
skipped and an older command-with-output was erased instead. "Erase the last
command" therefore did not erase the last command whenever the most recent ones
has no output.

Select the region by prompt marks instead: erase the prompt block immediately
above the current (live) prompt, whatever it contains. Every submittd command
is now one unit, removed newest-first, one prompt block per invocation.

This also fixes two latent defects in the previous implementation:

* The on-screen deletion was anchored at `cursor->y - count`, which
  assumes the region ends exactly one row above the cursor.
  Multi-line prompts and skipped rows broke that assumption and left
  residual lines. Anchor at the top of the region instead.

* When part of the erased region was in the scrollback, the lines
  were removed from the history buffer but no redraw was signalled,
  so the deletion of the off-screen lines only became visible after
  the next scroll event recomputed the history viewport. Clamp
  scrolled_by to the new history length and call dirty_scroll()
  after shrinking the buffer.

include_prompt is retained for API compatibility but is now a no-op: the
unit erased is always the whole prompt block.
2026-06-28 11:17:01 -03:00
Kovid Goyal
3fc5bed364
Merge branch 'decst8c' of https://github.com/aymanbagabas/kitty
Some checks failed
CI / Linux (python=3.13 cc=clang sanitize=1) (push) Has been cancelled
CI / Linux (python=3.11 cc=gcc sanitize=0) (push) Has been cancelled
CI / Linux (python=3.12 cc=gcc sanitize=1) (push) Has been cancelled
CI / Linux package (push) Has been cancelled
CI / Bundle test (macos-latest) (push) Has been cancelled
CI / Bundle test (ubuntu-latest) (push) Has been cancelled
CI / macOS Brew (push) Has been cancelled
CI / Test ./dev.sh and benchmark (push) Has been cancelled
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (c, macos-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Has been cancelled
Depscan / Scan dependencies for vulnerabilities (push) Has been cancelled
2026-05-27 08:38:45 +05:30
Kovid Goyal
c7622683c8
Cleanup previous PR 2026-05-27 08:31:41 +05:30
Ayman Bagabas
c68a1654d3 feat(vt): add support for DECST8C escape sequence
Recognize CSI ? 5 W as DECST8C, which resets the active screen's tab
stops to the default of every 8 columns. Other CSI W variants continue
to produce a parse error.

Signed-off-by: Ayman Bagabas <aymanbagabas@gmail.com>
2026-05-26 21:12:27 -04:00
Ayman Bagabas
3138ae4aad fix(screen): preserve tab stops across window resizes
Previously, every window resize reinitialised the tab stops to the
default of every 8 columns, discarding any stops set via HTS or cleared
via TBC. ECMA-48 only treats RIS, DECSTR, and DECCOLM as events that
reset tab stops, and other terminal emulators all preserve user-set
stops across an interactive resize.

Copy the surviving prefix of the previous tab stops into the freshly
allocated array on both main and alt screens. Newly added columns when
growing the window keep the default every 8 columns pattern. Also point
the active tabstops pointer at the alt screen's array when a resize
happens while the alt screen is active, instead of unconditionally
resetting it to the main screen's array.

Signed-off-by: Ayman Bagabas <aymanbagabas@gmail.com>
2026-05-26 21:12:27 -04:00
n-WN
708372f249
tests: regression for apply_selection with paused-rendering + scrollback
Add a regression test that exercises the code path which crashed in
v0.46.2 (#10017): when paused_rendering is active and a selection
extends into the scrollback, the inner loop of apply_selection iterates
with a negative y. Without the recently-added paused_y translation and
the paused_y < 0 guard, the call to linebuf_init_line treats the
negative y as a huge unsigned index_type and reads ~4GB out of bounds
in line_attrs[idx], crashing with SIGBUS.

The test reproduces the trigger deterministically via the Screen Python
bindings and asserts that current_selections() returns the expected
buffer instead of crashing.
2026-05-16 17:00:01 +08:00
copilot-swe-agent[bot]
f6f1cae3b7
Fix issue #9834: preserve trailing spaces on soft-wrapped lines during copy
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/343539f7-deab-4eeb-9829-99bec57c3523

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-08 17:17:20 +00:00
Kovid Goyal
fe0ecbd9ca
Regenerate palette colors when changing colors at runtime
Fixes #9763
2026-03-28 09:33:25 +05:30
Kovid Goyal
7e5aac2e2b
Allow setting color table value to none via OSC 21 2026-03-27 20:50:28 +05:30
Jake Stewart
1a62cde212
Add option to generate 256 color palette from first 16 colors
Needs more work to test and possibly implement reporting and setting
of the nullable color table colors.

Fixes #9426
2026-03-27 20:01:14 +05:30
copilot-swe-agent[bot]
d37a9fd48a
Fix marker highlighting for CJK/wide chars not at position 0
Fixes #9705
Fixes #9706
2026-03-19 15:35:14 +05:30
Kovid Goyal
8df80afa79
URL detection: Allow trailing asterisks in URLs
Fixes #9543
2026-02-23 07:54:47 +05:30
Kovid Goyal
a214097b55
Close hyperlinks more eagerly when serializing to ANSI
Fixes #9405
2026-01-23 10:11:26 +05:30
Kovid Goyal
573bfb688a
Move parsing of colors fully into C
Uses a perfect hash function for color name lookup
2025-12-31 14:21:45 +05:30
Kovid Goyal
44b5d8f656
Dont use negative numbers in multi cursor protocol
There are apparently many parsers out there that cant handle them.
2025-08-26 21:43:37 +05:30
Kovid Goyal
da641982e2
Start work on specifying a color for extra cursors 2025-08-26 18:56:31 +05:30
Kovid Goyal
518e06cfa4
Also report -2 in query response 2025-08-25 15:30:36 +05:30
Kovid Goyal
24049a1a5a
Implement round tripping of SGR blink (5/25) 2025-08-25 12:34:38 +05:30
Kovid Goyal
bacd13d3a7
extra cursors: Add some tests for invalid input handling 2025-08-24 20:25:38 +05:30
Kovid Goyal
8f5dc42a61
Parser for multi cursor escape code 2025-08-24 20:14:14 +05:30
Kovid Goyal
a0b58ef205
Dont allow CUB to move cursor onto previous line
Reserve this behavior for actual backspace. Fixes #8900
2025-08-14 21:49:36 +05:30
Kovid Goyal
b0439d4183
Function to erase the last command and its output 2025-08-07 08:45:45 +05:30
Kovid Goyal
f61b15b284
Fix incorrect handling of VS16 when it causes char to wrap to next line and is part of a draw command with more characters following it
Needed to initialize full text loop state rather than just segmentation
state on wrap. Fixes #8848
2025-07-26 09:25:01 +05:30
Kovid Goyal
45b2678db1
Allow backspace to wrap cursor to previous line
Fixes #8841
2025-07-23 08:56:54 +05:30
Kovid Goyal
d7c4d42f41
Fix #8794 2025-07-09 12:49:12 +05:30
Kovid Goyal
c681a999d5
Fix hyperlink id not being applied to wide cells
Fixes #8796
2025-07-09 12:14:09 +05:30
Kovid Goyal
eabddc2870
Report support for OSC52 write to clipboard in DA1
There are apparently some applications that want to only turn on OSC52
if they can be sure the terminal supports it.
https://github.com/contour-terminal/vt-extensions/blob/master/clipboard-extension.md

Seems harmless enough, though IMO the correct query mechanism for
runtime controllable settings is XTGETTCAP, but, let's be a
good citizen and co-operate. The overhead is not too large and I
have more important windmills to tilt at.

Fixes #8788
2025-07-07 08:45:58 +05:30
Kovid Goyal
bca017fa4c
Fix #8741 2025-06-20 20:11:23 +05:30
Kovid Goyal
8e55cf7552
Fix #8731 2025-06-14 20:19:21 +05:30
Kovid Goyal
61fd8c4003
Fix #8682 2025-05-27 12:10:14 +05:30
Kovid Goyal
2cad589f1c
Add tests for combining at screen edge 2025-04-11 09:34:21 +05:30
Kovid Goyal
f5e8de2e4f
Implement grapheme segmentation in the terminal layer 2025-04-11 09:34:21 +05:30
Arvin Verain
6d75f7cff4
test: Add method to easily set last_visited attributes 2025-03-28 22:38:19 +08:00
Arvin Verain
07f30122e6
test: Add more tests for cmd paging edge cases 2025-03-28 22:38:18 +08:00
Kovid Goyal
c4ef0a0eef
Add another test 2025-02-19 05:26:03 +05:30
Arvin Verain
a5cafdd8e9
test: Add more tests for scroll_to_prompt, fco, and lvco 2025-02-19 00:30:04 +08:00
Kovid Goyal
8f44e16b89
Fix scroll_to_prompt after resize that causes prompt line wrapping not accurate
See #8334
2025-02-18 19:40:23 +05:30
Kovid Goyal
c520b0b1b9
Add test for PR #8322 2025-02-18 10:08:41 +05:30
Kovid Goyal
2caa3fc069
... 2025-02-17 20:18:14 +05:30
Kovid Goyal
a7f76ee8f7
Fix #8339 2025-02-17 19:56:39 +05:30
Kovid Goyal
e7a40300d1
Fix crash when rendering a cell with a large number of combining chars
Caused by kitty now supporting larger number of combining chars per
cell. Fixes #8318
2025-02-12 08:23:46 +05:30
Kovid Goyal
8bf8f5dc46
Finish up testing for multicell URL detection 2025-02-03 10:56:50 +05:30
Kovid Goyal
97449dfddb
Cursor tracking tests
Also fix extra x movement for tracked cursors
2025-02-03 10:56:49 +05:30
Kovid Goyal
c4a32862d1
Implement restitch during rewrap
Faster, less code and gets us multicell handling during restitching for
free.
2025-02-03 10:56:49 +05:30
Kovid Goyal
33207a57ba
Add tests for consecutive conflicting variation selectors 2024-12-05 19:21:00 +05:30
Kovid Goyal
a4d2d933c9
Fix #8103 2024-12-05 19:19:15 +05:30
Kovid Goyal
8e388acab7
Add some cursor tracking tests 2024-11-27 20:33:56 +05:30
Kovid Goyal
778344a439
Fix enlarging window when a long line is wrapped between the first line of the scrollback buffer and the screen inserting a spurious newline
Fixes #7033
2024-11-27 20:08:27 +05:30
Kovid Goyal
97e4625a82
... 2024-11-12 09:29:17 +05:30