Fix --hold always restoring cursor to block shape instead of respecting the value of cursor_shape

This commit is contained in:
Kovid Goyal 2025-02-18 20:21:07 +05:30
parent 359d9e12e8
commit 375583259a
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
4 changed files with 12 additions and 4 deletions

View file

@ -133,6 +133,8 @@ Detailed list of changes
- Fix a regression in 0.39.0 that caused a crash on invalid Unicode with a
large number of combining characters in a single cell (:iss:`8318`)
- Fix ``--hold`` always restoring cursor to block shape instead of respecting the value of :opt:`cursor_shape` (:disc:`8344`)
0.39.1 [2025-02-01]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -618,6 +618,7 @@ parse_kitty_dcs(PS *self, uint8_t *buf, size_t bufsz) {
dispatch("ask|", handle_remote_askpass, 0)
dispatch("clone|", handle_remote_clone, 0)
dispatch("edit|", handle_remote_edit, 0)
dispatch("restore-cursor-appearance|", handle_restore_cursor_appearance, 0)
return false;
#undef dispatch

View file

@ -1524,6 +1524,13 @@ def handle_remote_print(self, msg: memoryview) -> None:
text = process_remote_print(msg)
print(text, end='', flush=True)
def handle_restore_cursor_appearance(self, msg: memoryview | None = None) -> None:
opts = get_options()
self.screen.cursor.blink = opts.cursor_blink_interval[0] != 0
self.screen.cursor.shape = opts.cursor_shape
self.screen.cursor_visible = True
delattr(self.screen.color_profile, 'cursor_color')
def send_cmd_response(self, response: Any) -> None:
self.screen.send_escape_code_to_child(ESC_DCS, '@kitty-cmd' + json.dumps(response))

View file

@ -222,10 +222,8 @@ func RunCommandRestoringTerminalToSaneStateAfter(cmd []string) {
defer func() {
_, _ = term.WriteString(strings.Join([]string{
loop.RESTORE_PRIVATE_MODE_VALUES,
"\x1b[=u", // reset kitty keyboard protocol to legacy
"\x1b[1 q", // blinking block cursor
loop.DECTCEM.EscapeCodeToSet(), // cursor visible
"\x1b]112\a", // reset cursor color
"\x1b[=u", // reset kitty keyboard protocol to legacy
"\x1bP@kitty-restore-cursor-appearance|\a",
}, ""))
_ = term.Tcsetattr(tty.TCSANOW, &state_before)
term.Close()