@@ -131,6 +131,7 @@ typedef struct {
131
131
int get_bg;
132
132
int set_underline_style;
133
133
int set_underline_color;
134
+
int enable_extended_keys, disable_extended_keys;
134
135
} unibi_ext;
135
136
char *space_buf;
136
137
} TUIData;
@@ -168,7 +169,7 @@ UI *tui_start(void)
168
169
ui->set_title = tui_set_title;
169
170
ui->set_icon = tui_set_icon;
170
171
ui->screenshot = tui_screenshot;
171
-
ui->option_set= tui_option_set;
172
+
ui->option_set = tui_option_set;
172
173
ui->raw_line = tui_raw_line;
173
174
174
175
memset(ui->ui_ext, 0, sizeof(ui->ui_ext));
@@ -308,6 +309,10 @@ static void terminfo_start(UI *ui)
308
309
// Enable bracketed paste
309
310
unibi_out_ext(ui, data->unibi_ext.enable_bracketed_paste);
310
311
312
+
// Enable extended keys (also known as 'modifyOtherKeys' or CSI u). On terminals that don't
313
+
// support this, this sequence is ignored.
314
+
unibi_out_ext(ui, data->unibi_ext.enable_extended_keys);
315
+
311
316
int ret;
312
317
uv_loop_init(&data->write_loop);
313
318
if (data->out_isatty) {
@@ -365,6 +370,8 @@ static void terminfo_stop(UI *ui)
365
370
unibi_out_ext(ui, data->unibi_ext.disable_bracketed_paste);
366
371
// Disable focus reporting
367
372
unibi_out_ext(ui, data->unibi_ext.disable_focus_reporting);
373
+
// Disable extended keys
374
+
unibi_out_ext(ui, data->unibi_ext.disable_extended_keys);
368
375
flush_buf(ui);
369
376
uv_tty_reset_mode();
370
377
uv_close((uv_handle_t *)&data->output_handle, NULL);
@@ -1378,7 +1385,6 @@ static void tui_screenshot(UI *ui, String path)
1378
1385
fclose(f);
1379
1386
}
1380
1387
1381
-
1382
1388
static void tui_option_set(UI *ui, String name, Object value)
1383
1389
{
1384
1390
TUIData *data = ui->data;
@@ -1387,11 +1393,9 @@ static void tui_option_set(UI *ui, String name, Object value)
1387
1393
1388
1394
data->print_attr_id = -1;
1389
1395
invalidate(ui, 0, data->grid.height, 0, data->grid.width);
1390
-
}
1391
-
if (strequal(name.data, "ttimeout")) {
1396
+
} else if (strequal(name.data, "ttimeout")) {
1392
1397
data->input.ttimeout = value.data.boolean;
1393
-
}
1394
-
if (strequal(name.data, "ttimeoutlen")) {
1398
+
} else if (strequal(name.data, "ttimeoutlen")) {
1395
1399
data->input.ttimeoutlen = (long)value.data.integer;
1396
1400
}
1397
1401
}
@@ -1944,6 +1948,7 @@ static void augment_terminfo(TUIData *data, const char *term, long vte_version,
1944
1948
|| terminfo_is_term_family(term, "iTerm.app")
1945
1949
|| terminfo_is_term_family(term, "iTerm2.app");
1946
1950
bool alacritty = terminfo_is_term_family(term, "alacritty");
1951
+
bool kitty = terminfo_is_term_family(term, "xterm-kitty");
1947
1952
// None of the following work over SSH; see :help TERM .
1948
1953
bool iterm_pretending_xterm = xterm && iterm_env;
1949
1954
@@ -2067,6 +2072,15 @@ static void augment_terminfo(TUIData *data, const char *term, long vte_version,
2067
2072
data->unibi_ext.set_underline_color = (int)unibi_add_ext_str(ut, "ext.set_underline_color",
2068
2073
"\x1b[58:2::%p1%d:%p2%d:%p3%dm");
2069
2074
}
2075
+
2076
+
if (!kitty) {
2077
+
// Kitty does not support these sequences; it only supports it's own CSI > 1 u which enables the
2078
+
// Kitty keyboard protocol
2079
+
data->unibi_ext.enable_extended_keys = (int)unibi_add_ext_str(ut, "ext.enable_extended_keys",
2080
+
"\x1b[>4;1m");
2081
+
data->unibi_ext.disable_extended_keys = (int)unibi_add_ext_str(ut, "ext.disable_extended_keys",
2082
+
"\x1b[>4;0m");
2083
+
}
2070
2084
}
2071
2085
2072
2086
static void flush_buf(UI *ui)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4