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.
This commit is contained in:
Kovid Goyal 2022-02-27 10:55:02 +05:30
parent 33abd31d1a
commit ef5c66ee17
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 1 additions and 13 deletions

View File

@ -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

View File

@ -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);

View File

@ -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*);

View File

@ -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