Skip to content

Commit

Permalink
Add support for XTVERSION version reporting escape code
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jun 14, 2021
1 parent 79b130e commit 057084a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog
|kitty| is a feature-rich, cross-platform, *fast*, GPU based terminal.
To update |kitty|, :doc:`follow the instructions <binary>`.

0.21.2 [future]
----------------------

- Add support for the XTVERSION escape code

0.21.1 [2021-06-14]
----------------------

Expand Down
9 changes: 8 additions & 1 deletion kitty/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,14 @@ dispatch_csi(Screen *screen, PyObject DUMP_UNUSED *dump_callback) {
REPORT_ERROR("Unknown CSI x sequence with start and end modifiers: '%c' '%c'", start_modifier, end_modifier);
break;
case DECSCUSR:
CALL_CSI_HANDLER1M(screen_set_cursor, 1);
if (!start_modifier && end_modifier == ' ') {
CALL_CSI_HANDLER1M(screen_set_cursor, 1);
}
if (start_modifier == '>' && !end_modifier) {
CALL_CSI_HANDLER1(screen_xtversion, 0);
}
REPORT_ERROR("Unknown CSI q sequence with start and end modifiers: '%c' '%c'", start_modifier, end_modifier);
break;
case SU:
NO_MODIFIERS(end_modifier, ' ', "Select presentation directions escape code not implemented");
CALL_CSI_HANDLER1(screen_scroll, 1);
Expand Down
7 changes: 7 additions & 0 deletions kitty/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,13 @@ report_device_attributes(Screen *self, unsigned int mode, char start_modifier) {
}
}

void
screen_xtversion(Screen *self, unsigned int mode) {
if (mode == 0) {
write_escape_code_to_child(self, DCS, ">|kitty(" XT_VERSION ")");
}
}

void
screen_report_size(Screen *self, unsigned int which) {
char buf[32] = {0};
Expand Down
1 change: 1 addition & 0 deletions kitty/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ void screen_clear_tab_stop(Screen *self, unsigned int how);
void screen_set_mode(Screen *self, unsigned int mode);
void screen_reset_mode(Screen *self, unsigned int mode);
void screen_decsace(Screen *self, unsigned int);
void screen_xtversion(Screen *self, unsigned int);
void screen_insert_characters(Screen *self, unsigned int count);
void screen_cursor_up(Screen *self, unsigned int count/*=1*/, bool do_carriage_return/*=false*/, int move_direction/*=-1*/);
void screen_set_cursor(Screen *self, unsigned int mode, uint8_t secondary);
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ def kitty_env() -> Env:
cppflags = ans.cppflags
cppflags.append('-DPRIMARY_VERSION={}'.format(version[0] + 4000))
cppflags.append('-DSECONDARY_VERSION={}'.format(version[1]))
cppflags.append('-DXT_VERSION="{}"'.format('.'.join(map(str, version))))
at_least_version('harfbuzz', 1, 5)
cflags.extend(pkg_config('libpng', '--cflags-only-I'))
cflags.extend(pkg_config('lcms2', '--cflags-only-I'))
Expand Down

0 comments on commit 057084a

Please sign in to comment.