Clear prompt markings when erasing the display

Fixes prompt detection failing after ctrl+l
This commit is contained in:
Kovid Goyal
2021-11-24 08:17:04 +05:30
parent b35dd5a869
commit a62e831932
4 changed files with 10 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Integrate kitty closely with common shells such as zsh, fish and bash.
This allows lots of niceties such as jumping to previous prompts, opening the
output of the last command in a new window, etc. See :ref:`shell_integration`
for details.
for details. Packagers please read :ref:`packagers`.
- A new shortcut :sc:`focus_visible_window` to visually focus a window using
the keyboard. Pressing it causes numbers to appear over each visible window

View File

@@ -57,6 +57,12 @@ linebuf_mark_line_as_not_continued(LineBuf *self, index_type y) {
self->line_attrs[y].continued = false;
}
void
linebuf_clear_attrs_and_dirty(LineBuf *self, index_type y) {
self->line_attrs[y].val = 0;
self->line_attrs[y].has_dirty_text = true;
}
static PyObject*
clear(LineBuf *self, PyObject *a UNUSED) {
#define clear_doc "Clear all lines in this LineBuf"

View File

@@ -103,6 +103,7 @@ void linebuf_delete_lines(LineBuf *self, index_type num, index_type y, index_typ
void linebuf_copy_line_to(LineBuf *, Line *, index_type);
void linebuf_rewrap(LineBuf *self, LineBuf *other, index_type *, index_type *, HistoryBuf *, index_type *, index_type *, index_type *, index_type *, ANSIBuf*);
void linebuf_mark_line_dirty(LineBuf *self, index_type y);
void linebuf_clear_attrs_and_dirty(LineBuf *self, index_type y);
void linebuf_mark_line_clean(LineBuf *self, index_type y);
void linebuf_mark_line_as_not_continued(LineBuf *self, index_type y);
unsigned int linebuf_char_width_at(LineBuf *self, index_type x, index_type y);

View File

@@ -1647,15 +1647,14 @@ screen_erase_in_display(Screen *self, unsigned int how, bool private) {
} else {
line_apply_cursor(self->linebuf->line, self->cursor, 0, self->columns, true);
}
linebuf_mark_line_dirty(self->linebuf, i);
linebuf_mark_line_as_not_continued(self->linebuf, i);
linebuf_clear_attrs_and_dirty(self->linebuf, i);
}
self->is_dirty = true;
clear_selection(&self->selections);
}
if (how != 2) {
screen_erase_in_line(self, how, private);
if (how == 1) linebuf_mark_line_as_not_continued(self->linebuf, self->cursor->y);
if (how == 1) linebuf_clear_attrs_and_dirty(self->linebuf, self->cursor->y);
}
if (how == 3 && self->linebuf == self->main_linebuf) {
historybuf_clear(self->historybuf);