This commit is contained in:
Kovid Goyal 2021-08-15 19:31:43 +05:30
parent eb2f3387c5
commit 2715947830
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 10 deletions

View file

@ -1034,7 +1034,7 @@ screen_current_char_width(Screen *self) {
}
bool
screen_is_cursor_visible(Screen *self) {
screen_is_cursor_visible(const Screen *self) {
return self->modes.mDECTCEM;
}
@ -1347,7 +1347,7 @@ screen_cursor_to_line(Screen *self, unsigned int line) {
int
screen_cursor_at_a_shell_prompt(const Screen *self) {
if (self->cursor->y >= self->lines || self->linebuf != self->main_linebuf) return false;
if (self->cursor->y >= self->lines || self->linebuf != self->main_linebuf || !screen_is_cursor_visible(self)) return -1;
for (index_type y=self->cursor->y + 1; y-- > 0; ) {
linebuf_init_line(self->linebuf, y);
if (self->linebuf->line->attrs.is_output_start) return -1;
@ -3358,13 +3358,8 @@ dump_lines_with_attrs(Screen *self, PyObject *accum) {
static PyObject*
cursor_at_prompt(Screen *self, PyObject *args UNUSED) {
if (self->cursor->y >= self->lines || !screen_is_cursor_visible(self) || self->linebuf != self->main_linebuf) { Py_RETURN_FALSE; }
int y = self->cursor->y;
while (y >= 0) {
linebuf_init_line(self->linebuf, y--);
if (self->linebuf->line->attrs.is_prompt_start) { Py_RETURN_TRUE; }
if (self->linebuf->line->attrs.is_output_start) { Py_RETURN_FALSE; }
}
int y = screen_cursor_at_a_shell_prompt(self);
if (y > -1) { Py_RETURN_TRUE; }
Py_RETURN_FALSE;
}

View file

@ -213,7 +213,7 @@ bool screen_is_selection_dirty(Screen *self);
bool screen_has_selection(Screen*);
bool screen_invert_colors(Screen *self);
void screen_update_cell_data(Screen *self, void *address, FONTS_DATA_HANDLE, bool cursor_has_moved);
bool screen_is_cursor_visible(Screen *self);
bool screen_is_cursor_visible(const Screen *self);
bool screen_selection_range_for_line(Screen *self, index_type y, index_type *start, index_type *end);
bool screen_selection_range_for_word(Screen *self, const index_type x, const index_type y, index_type *, index_type *, index_type *start, index_type *end, bool);
void screen_start_selection(Screen *self, index_type x, index_type y, bool, bool, SelectionExtendMode);