Add support for xterms report OS window size escape code

This commit is contained in:
Kovid Goyal 2025-11-24 11:12:27 +05:30
parent 701d229139
commit 3944a41c00
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 11 additions and 5 deletions

View file

@ -2714,15 +2714,21 @@ screen_xtversion(Screen *self, unsigned int mode) {
}
void
screen_report_size(Screen *self, unsigned int which) {
screen_report_size(Screen *self, unsigned which, unsigned modifier) {
char buf[32] = {0};
unsigned int code = 0;
unsigned int width = 0, height = 0;
unsigned code = 0, width = 0, height = 0;
switch(which) {
case 14:
code = 4;
width = self->cell_size.width * self->columns;
height = self->cell_size.height * self->lines;
if (modifier == 2 && self->window_id) {
OSWindow *osw = os_window_for_kitty_window(self->window_id);
if (osw) {
int w, h, fw, fh; get_os_window_size(osw, &w, &h, &fw, &fh);
width = fw; height = fh;
}
}
break;
case 16:
code = 6;

View file

@ -291,7 +291,7 @@ bool screen_set_last_visited_prompt(Screen*, index_type);
bool screen_select_cmd_output(Screen*, index_type);
void screen_dirty_sprite_positions(Screen *self);
void screen_rescale_images(Screen *self);
void screen_report_size(Screen *, unsigned int which);
void screen_report_size(Screen *, unsigned which, unsigned modifier);
void screen_manipulate_title_stack(Screen *, unsigned int op, unsigned int which);
bool screen_is_overlay_active(Screen *self);
void screen_update_overlay_text(Screen *self, const char *utf8_text);

View file

@ -1286,7 +1286,7 @@ dispatch_csi(PS *self) {
case 14:
case 16:
case 18:
CALL_CSI_HANDLER1(screen_report_size, 0);
CALL_CSI_HANDLER2(screen_report_size, 0, 0);
break;
case 22:
case 23: