Implement window title stack
Used by new versions of vim
This commit is contained in:
parent
0e248b3faa
commit
3067103b18
@ -122,6 +122,10 @@ def draw(*a):
|
|||||||
write(' '.join(a))
|
write(' '.join(a))
|
||||||
|
|
||||||
|
|
||||||
|
def screen_manipulate_title_stack(op, which):
|
||||||
|
write(CSI + '%d;%dt' % (op, which))
|
||||||
|
|
||||||
|
|
||||||
def report_device_attributes(mode, char):
|
def report_device_attributes(mode, char):
|
||||||
x = CSI
|
x = CSI
|
||||||
if char:
|
if char:
|
||||||
|
|||||||
@ -703,21 +703,29 @@ dispatch_csi(Screen *screen, PyObject DUMP_UNUSED *dump_callback) {
|
|||||||
REPORT_ERROR("Unknown CSI s sequence with start and end modifiers: '%c' '%c' and %u parameters", start_modifier, end_modifier, num_params);
|
REPORT_ERROR("Unknown CSI s sequence with start and end modifiers: '%c' '%c' and %u parameters", start_modifier, end_modifier, num_params);
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
if (!start_modifier && !end_modifier && num_params == 1) {
|
if (!num_params) {
|
||||||
|
REPORT_ERROR("Unknown CSI t sequence with start and end modifiers: '%c' '%c' and no parameters", start_modifier, end_modifier);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (start_modifier || end_modifier) {
|
||||||
|
REPORT_ERROR("Unknown CSI t sequence with start and end modifiers: '%c' '%c', %u parameters and first parameter: %u", start_modifier, end_modifier, num_params, params[0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
switch(params[0]) {
|
switch(params[0]) {
|
||||||
case 14:
|
case 14:
|
||||||
case 16:
|
case 16:
|
||||||
case 18:
|
case 18:
|
||||||
CALL_CSI_HANDLER1(screen_report_size, 0);
|
CALL_CSI_HANDLER1(screen_report_size, 0);
|
||||||
break;
|
break;
|
||||||
|
case 22:
|
||||||
|
case 23:
|
||||||
|
CALL_CSI_HANDLER2(screen_manipulate_title_stack, 22, 0);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
REPORT_ERROR("Unknown CSI t sequences with parameter: '%u'", params[0]);
|
REPORT_ERROR("Unknown CSI t window manipulation sequence with %u parameters and first parameter: %u", num_params, params[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
REPORT_ERROR("Unknown CSI t sequence with start and end modifiers: '%c' '%c' and %u parameters", start_modifier, end_modifier, num_params);
|
|
||||||
break;
|
|
||||||
case 'u':
|
case 'u':
|
||||||
if (!start_modifier && !end_modifier && !num_params) {
|
if (!start_modifier && !end_modifier && !num_params) {
|
||||||
REPORT_COMMAND(screen_restore_cursor);
|
REPORT_COMMAND(screen_restore_cursor);
|
||||||
|
|||||||
@ -1254,6 +1254,15 @@ screen_report_size(Screen *self, unsigned int which) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
screen_manipulate_title_stack(Screen *self, unsigned int op, unsigned int which) {
|
||||||
|
CALLBACK("manipulate_title_stack", "OOO",
|
||||||
|
op == 23 ? Py_True : Py_False,
|
||||||
|
which == 0 || which == 2 ? Py_True : Py_False,
|
||||||
|
which == 0 || which == 1 ? Py_True : Py_False
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
report_device_status(Screen *self, unsigned int which, bool private) {
|
report_device_status(Screen *self, unsigned int which, bool private) {
|
||||||
// We don't implement the private device status codes, since I haven't come
|
// We don't implement the private device status codes, since I haven't come
|
||||||
|
|||||||
@ -191,6 +191,7 @@ bool screen_open_url(Screen*);
|
|||||||
void screen_dirty_sprite_positions(Screen *self);
|
void screen_dirty_sprite_positions(Screen *self);
|
||||||
void screen_rescale_images(Screen *self);
|
void screen_rescale_images(Screen *self);
|
||||||
void screen_report_size(Screen *, unsigned int which);
|
void screen_report_size(Screen *, unsigned int which);
|
||||||
|
void screen_manipulate_title_stack(Screen *, unsigned int op, unsigned int which);
|
||||||
void screen_draw_overlay_text(Screen *self, const char *utf8_text);
|
void screen_draw_overlay_text(Screen *self, const char *utf8_text);
|
||||||
#define DECLARE_CH_SCREEN_HANDLER(name) void screen_##name(Screen *screen);
|
#define DECLARE_CH_SCREEN_HANDLER(name) void screen_##name(Screen *screen);
|
||||||
DECLARE_CH_SCREEN_HANDLER(bell)
|
DECLARE_CH_SCREEN_HANDLER(bell)
|
||||||
|
|||||||
@ -110,6 +110,7 @@ class Window:
|
|||||||
self.overlay_for = None
|
self.overlay_for = None
|
||||||
self.default_title = os.path.basename(child.argv[0] or appname)
|
self.default_title = os.path.basename(child.argv[0] or appname)
|
||||||
self.child_title = self.default_title
|
self.child_title = self.default_title
|
||||||
|
self.title_stack = deque(maxlen=10)
|
||||||
self.allow_remote_control = child.allow_remote_control
|
self.allow_remote_control = child.allow_remote_control
|
||||||
self.id = add_window(tab.os_window_id, tab.id, self.title)
|
self.id = add_window(tab.os_window_id, tab.id, self.title)
|
||||||
if not self.id:
|
if not self.id:
|
||||||
@ -413,6 +414,16 @@ class Window:
|
|||||||
write('c', set_clipboard_string)
|
write('c', set_clipboard_string)
|
||||||
if 'write-primary' in self.opts.clipboard_control:
|
if 'write-primary' in self.opts.clipboard_control:
|
||||||
write('p', set_primary_selection)
|
write('p', set_primary_selection)
|
||||||
|
|
||||||
|
def manipulate_title_stack(self, pop, title, icon):
|
||||||
|
if title:
|
||||||
|
if pop:
|
||||||
|
if self.title_stack:
|
||||||
|
self.child_title = self.title_stack.popleft()
|
||||||
|
self.title_updated()
|
||||||
|
else:
|
||||||
|
if self.child_title:
|
||||||
|
self.title_stack.append(self.child_title)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
def text_for_selection(self):
|
def text_for_selection(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user