Fix no cursor position update after drawing small amounts of text

This commit is contained in:
Kovid Goyal 2016-11-18 16:46:04 +05:30
parent 14c6d327fd
commit 6293b37ead
2 changed files with 3 additions and 0 deletions

View File

@ -231,6 +231,7 @@ screen_draw_charset(Screen *self, unsigned short *table, uint8_t *buf, unsigned
}
void screen_draw(Screen *self, uint8_t *buf, unsigned int buflen) {
unsigned int x = self->cursor->x, y = self->cursor->y;
switch(self->current_charset) {
case 0:
screen_draw_charset(self, self->g0_charset, buf, buflen); break;
@ -239,6 +240,7 @@ void screen_draw(Screen *self, uint8_t *buf, unsigned int buflen) {
default:
screen_draw_utf8(self, buf, buflen); break;
}
if (x != self->cursor->x || y != self->cursor->y) tracker_cursor_changed(self->change_tracker);
}
// }}}

View File

@ -51,6 +51,7 @@ class TestScreen(BaseTest):
pb('12', '12')
self.ae(str(s.line(0)), '12 ')
self.ae(s.cursor.x, 2)
pb('3456', '3456')
self.ae(str(s.line(0)), '12345')
self.ae(str(s.line(1)), '6 ')