From ef5c66ee17d31105ddd7379abe402ff87e9fa9d4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Feb 2022 10:55:02 +0530 Subject: [PATCH] Dont bother with new escape code for setting title Since we are only sending the last command, it cannot have CSI sequences in it anyway except in extremely contrived situations, so just strip all ctrl chars out. --- kitty/parser.c | 4 ---- kitty/screen.c | 6 ------ kitty/screen.h | 1 - shell-integration/bash/kitty.bash | 3 +-- 4 files changed, 1 insertion(+), 13 deletions(-) diff --git a/kitty/parser.c b/kitty/parser.c index 19c79eb70..97be57c9b 100644 --- a/kitty/parser.c +++ b/kitty/parser.c @@ -406,10 +406,6 @@ dispatch_osc(Screen *screen, PyObject DUMP_UNUSED *dump_callback) { START_DISPATCH DISPATCH_OSC(set_title); END_DISPATCH - case 22222: - START_DISPATCH - DISPATCH_OSC(set_title_base64); - END_DISPATCH case 4: case 104: START_DISPATCH diff --git a/kitty/screen.c b/kitty/screen.c index f748b70aa..85414fa9e 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1967,12 +1967,6 @@ set_title(Screen *self, PyObject *title) { CALLBACK("title_changed", "O", title); } -void -set_title_base64(Screen *self, PyObject *title) { - CALLBACK("title_changed", "OO", title, Py_True); -} - - void desktop_notify(Screen *self, unsigned int osc_code, PyObject *data) { CALLBACK("desktop_notify", "IO", osc_code, data); diff --git a/kitty/screen.h b/kitty/screen.h index 3a64b4bfd..f557b71e2 100644 --- a/kitty/screen.h +++ b/kitty/screen.h @@ -211,7 +211,6 @@ void screen_handle_print(Screen *, PyObject *cmd); void screen_designate_charset(Screen *, uint32_t which, uint32_t as); void screen_use_latin1(Screen *, bool); void set_title(Screen *self, PyObject*); -void set_title_base64(Screen *self, PyObject*); void desktop_notify(Screen *self, unsigned int, PyObject*); void set_icon(Screen *self, PyObject*); void set_dynamic_color(Screen *self, unsigned int code, PyObject*); diff --git a/shell-integration/bash/kitty.bash b/shell-integration/bash/kitty.bash index d3437b6ac..e86f85949 100644 --- a/shell-integration/bash/kitty.bash +++ b/shell-integration/bash/kitty.bash @@ -139,8 +139,7 @@ _ksi_main() { last_cmd=$(HISTTIMEFORMAT= builtin history 1) last_cmd="${last_cmd#*[[:digit:]]*[[:space:]]}" # remove leading history number last_cmd="${last_cmd#"${last_cmd%%[![:space:]]*}"}" # remove remaining leading whitespace - last_cmd=$(builtin printf "%s" "$last_cmd" | base64) - builtin printf "\e]22222;%s\a" "${last_cmd//[[:space:]]}" + builtin printf "\e]2;%s\a" "${last_cmd//[[:cntrl:]]}" # remove any control characters } _ksi_prompt[ps0_suffix]+='$(_ksi_get_current_command)' fi