mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-03 07:15:29 -04:00
csi: implement CSI 22t and CSI 23t
22;0|1|2t pushes the current window title/icon to the stack, while 23 pops it. The second parameter, 0|1|2 has the following meaning: 0 - push/pop icon+title 1 - push/pop icon 2 - push/pop title
This commit is contained in:
parent
97350f6488
commit
64135ae365
4 changed files with 38 additions and 6 deletions
36
csi.c
36
csi.c
|
|
@ -546,11 +546,39 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
break;
|
||||
}
|
||||
|
||||
case 't':
|
||||
/* 22 - save window title */
|
||||
/* 23 - restore window title */
|
||||
LOG_WARN("ignoring %s", csi_as_string(term, final));
|
||||
case 't': {
|
||||
unsigned param = vt_param_get(term, 0, 0);
|
||||
|
||||
switch (param) {
|
||||
case 22: { /* push window title */
|
||||
/* 0 - icon + title, 1 - icon, 2 - title */
|
||||
unsigned what = vt_param_get(term, 1, 0);
|
||||
if (what == 0 || what == 2) {
|
||||
tll_push_back(
|
||||
term->window_title_stack, strdup(term->window_title));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 23: { /* pop window title */
|
||||
/* 0 - icon + title, 1 - icon, 2 - title */
|
||||
unsigned what = vt_param_get(term, 1, 0);
|
||||
if (what == 0 || what == 2) {
|
||||
if (tll_length(term->window_title_stack) > 0) {
|
||||
char *title = tll_pop_back(term->window_title_stack);
|
||||
term_set_window_title(term, title);
|
||||
free(title);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
LOG_WARN("ignoring %s", csi_as_string(term, final));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'n': {
|
||||
if (term->vt.params.idx > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue