Match save/restore cursor behavior of other terms
For the sake of interoperability. This means that doing a DECRC without a prior DECSC is now undefined. However, one can now issue multiple DECRC for a single DECSC. Fixes #1264
This commit is contained in:
parent
00aba7c646
commit
b00cd5cbc3
@ -38,6 +38,10 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
- Fix one ANSI formatting escape code not being removed from the pager history
|
- Fix one ANSI formatting escape code not being removed from the pager history
|
||||||
buffer when piping it as plain text (:iss:`3132`)
|
buffer when piping it as plain text (:iss:`3132`)
|
||||||
|
|
||||||
|
- Match the save/restore cursor behavior of other terminals, for the sake of
|
||||||
|
interoperability. This means that doing a DECRC without a prior DECSC is now
|
||||||
|
undefined (:iss:`1264`)
|
||||||
|
|
||||||
|
|
||||||
0.19.2 [2020-11-13]
|
0.19.2 [2020-11-13]
|
||||||
-------------------
|
-------------------
|
||||||
|
|||||||
@ -149,6 +149,8 @@ void
|
|||||||
screen_reset(Screen *self) {
|
screen_reset(Screen *self) {
|
||||||
if (self->linebuf == self->alt_linebuf) screen_toggle_screen_buffer(self, true, true);
|
if (self->linebuf == self->alt_linebuf) screen_toggle_screen_buffer(self, true, true);
|
||||||
if (self->overlay_line.is_active) deactivate_overlay_line(self);
|
if (self->overlay_line.is_active) deactivate_overlay_line(self);
|
||||||
|
self->main_savepoint.is_valid = false;
|
||||||
|
self->alt_savepoint.is_valid = false;
|
||||||
linebuf_clear(self->linebuf, BLANK_CHAR);
|
linebuf_clear(self->linebuf, BLANK_CHAR);
|
||||||
historybuf_clear(self->historybuf);
|
historybuf_clear(self->historybuf);
|
||||||
clear_hyperlink_pool(self->hyperlink_pool);
|
clear_hyperlink_pool(self->hyperlink_pool);
|
||||||
@ -1096,14 +1098,13 @@ screen_linefeed(Screen *self) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
screen_save_cursor(Screen *self) {
|
screen_save_cursor(Screen *self) {
|
||||||
SavepointBuffer *pts = self->linebuf == self->main_linebuf ? &self->main_savepoints : &self->alt_savepoints;
|
Savepoint *sp = self->linebuf == self->main_linebuf ? &self->main_savepoint : &self->alt_savepoint;
|
||||||
Savepoint *sp;
|
|
||||||
buffer_push(pts, sp);
|
|
||||||
cursor_copy_to(self->cursor, &(sp->cursor));
|
cursor_copy_to(self->cursor, &(sp->cursor));
|
||||||
sp->mDECOM = self->modes.mDECOM;
|
sp->mDECOM = self->modes.mDECOM;
|
||||||
sp->mDECAWM = self->modes.mDECAWM;
|
sp->mDECAWM = self->modes.mDECAWM;
|
||||||
sp->mDECSCNM = self->modes.mDECSCNM;
|
sp->mDECSCNM = self->modes.mDECSCNM;
|
||||||
COPY_CHARSETS(self, sp);
|
COPY_CHARSETS(self, sp);
|
||||||
|
sp->is_valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1115,10 +1116,8 @@ screen_save_modes(Screen *self) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
screen_restore_cursor(Screen *self) {
|
screen_restore_cursor(Screen *self) {
|
||||||
SavepointBuffer *pts = self->linebuf == self->main_linebuf ? &self->main_savepoints : &self->alt_savepoints;
|
Savepoint *sp = self->linebuf == self->main_linebuf ? &self->main_savepoint : &self->alt_savepoint;
|
||||||
Savepoint *sp;
|
if (!sp->is_valid) {
|
||||||
buffer_pop(pts, sp);
|
|
||||||
if (sp == NULL) {
|
|
||||||
screen_cursor_position(self, 1, 1);
|
screen_cursor_position(self, 1, 1);
|
||||||
screen_reset_mode(self, DECOM);
|
screen_reset_mode(self, DECOM);
|
||||||
RESET_CHARSETS;
|
RESET_CHARSETS;
|
||||||
|
|||||||
@ -58,16 +58,10 @@ typedef struct {
|
|||||||
bool use_latin1;
|
bool use_latin1;
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
bool mDECOM, mDECAWM, mDECSCNM;
|
bool mDECOM, mDECAWM, mDECSCNM;
|
||||||
|
bool is_valid;
|
||||||
} Savepoint;
|
} Savepoint;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
Savepoint buf[SAVEPOINTS_SZ];
|
|
||||||
index_type start_of_data, count;
|
|
||||||
} SavepointBuffer;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ScreenModes buf[SAVEPOINTS_SZ];
|
ScreenModes buf[SAVEPOINTS_SZ];
|
||||||
index_type start_of_data, count;
|
index_type start_of_data, count;
|
||||||
@ -97,7 +91,7 @@ typedef struct {
|
|||||||
} last_rendered;
|
} last_rendered;
|
||||||
bool use_latin1, is_dirty, scroll_changed, reload_all_gpu_data;
|
bool use_latin1, is_dirty, scroll_changed, reload_all_gpu_data;
|
||||||
Cursor *cursor;
|
Cursor *cursor;
|
||||||
SavepointBuffer main_savepoints, alt_savepoints;
|
Savepoint main_savepoint, alt_savepoint;
|
||||||
SavemodesBuffer modes_savepoints;
|
SavemodesBuffer modes_savepoints;
|
||||||
PyObject *callbacks, *test_child;
|
PyObject *callbacks, *test_child;
|
||||||
LineBuf *linebuf, *main_linebuf, *alt_linebuf;
|
LineBuf *linebuf, *main_linebuf, *alt_linebuf;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user