When text is received from the terminal program and the overlay line is active move the overlay line after drawing the text
This ensures the overlay line follows the current cursor position
This commit is contained in:
parent
7e5cb50925
commit
c8f26dd968
@ -646,8 +646,9 @@ draw_combining_char(Screen *self, char_type ch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
screen_draw(Screen *self, uint32_t och, bool from_input_stream) {
|
static void
|
||||||
|
draw_impl(Screen *self, char_type och, bool from_input_stream) {
|
||||||
if (is_ignored_char(och)) return;
|
if (is_ignored_char(och)) return;
|
||||||
if (!self->has_activity_since_last_focus && !self->has_focus) {
|
if (!self->has_activity_since_last_focus && !self->has_focus) {
|
||||||
self->has_activity_since_last_focus = true;
|
self->has_activity_since_last_focus = true;
|
||||||
@ -725,6 +726,31 @@ screen_draw_overlay_text(Screen *self, const char *utf8_text) {
|
|||||||
self->modes.mDECAWM = orig_line_wrap_mode;
|
self->modes.mDECAWM = orig_line_wrap_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
|
get_overlay_text(Screen *self) {
|
||||||
|
#define ol self->overlay_line
|
||||||
|
if (ol.ynum >= self->lines || ol.xnum >= self->columns || !ol.xnum) return NULL;
|
||||||
|
Line *line = range_line_(self, ol.ynum);
|
||||||
|
if (!line) return NULL;
|
||||||
|
return unicode_in_range(line, ol.xstart, ol.xstart + ol.xnum, true, 0, true);
|
||||||
|
#undef ol
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
screen_draw(Screen *self, uint32_t och, bool from_input_stream) {
|
||||||
|
PyObject *overlay_text = NULL;
|
||||||
|
if (from_input_stream && self->overlay_line.is_active) {
|
||||||
|
overlay_text = get_overlay_text(self);
|
||||||
|
deactivate_overlay_line(self);
|
||||||
|
}
|
||||||
|
draw_impl(self, och, from_input_stream);
|
||||||
|
if (overlay_text) {
|
||||||
|
screen_draw_overlay_text(self, PyUnicode_AsUTF8(overlay_text));
|
||||||
|
Py_DECREF(overlay_text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
screen_align(Screen *self) {
|
screen_align(Screen *self) {
|
||||||
self->margin_top = 0; self->margin_bottom = self->lines - 1;
|
self->margin_top = 0; self->margin_bottom = self->lines - 1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user