Fix wide chars not being rendered

This commit is contained in:
Kovid Goyal 2017-09-15 11:43:05 +05:30
parent f0a9f32d0a
commit 28430a4104
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 6 additions and 6 deletions

View file

@ -507,7 +507,7 @@ left_shift(Line *self, PyObject *args) {
}
void
line_set_char(Line *self, unsigned int at, uint32_t ch, unsigned int width, Cursor *cursor) {
line_set_char(Line *self, unsigned int at, uint32_t ch, unsigned int width, Cursor *cursor, bool is_second) {
char_type attrs;
if (cursor == NULL) {
attrs = (((self->cells[at].ch >> ATTRS_SHIFT) & ~WIDTH_MASK) | (width & WIDTH_MASK)) << ATTRS_SHIFT;
@ -519,7 +519,7 @@ line_set_char(Line *self, unsigned int at, uint32_t ch, unsigned int width, Curs
}
self->cells[at].ch = (ch & CHAR_MASK) | attrs;
self->cells[at].cc = 0;
if (CHAR_IS_BLANK(ch)) { clear_sprite_position(self->cells[at]); }
if (!is_second && CHAR_IS_BLANK(ch)) { clear_sprite_position(self->cells[at]); }
else set_sprite_position_at(at);
}
@ -535,7 +535,7 @@ set_char(Line *self, PyObject *args) {
PyErr_SetString(PyExc_ValueError, "Out of bounds");
return NULL;
}
line_set_char(self, at, ch, width, cursor);
line_set_char(self, at, ch, width, cursor, false);
Py_RETURN_NONE;
}

View file

@ -58,7 +58,7 @@ xlimit_for_line(Line *line) {
PyObject* line_text_at(char_type, combining_type);
void line_clear_text(Line *self, unsigned int at, unsigned int num, int ch);
void line_apply_cursor(Line *self, Cursor *cursor, unsigned int at, unsigned int num, bool clear_char);
void line_set_char(Line *, unsigned int , uint32_t , unsigned int , Cursor *);
void line_set_char(Line *, unsigned int , uint32_t , unsigned int , Cursor *, bool);
void line_right_shift(Line *, unsigned int , unsigned int );
void line_add_combining_char(Line *, uint32_t , unsigned int );
index_type line_url_start_at(Line *self, index_type x);

View file

@ -280,10 +280,10 @@ screen_draw(Screen *self, uint32_t och) {
if (self->modes.mIRM) {
line_right_shift(self->linebuf->line, self->cursor->x, char_width);
}
line_set_char(self->linebuf->line, self->cursor->x, ch, char_width, self->cursor);
line_set_char(self->linebuf->line, self->cursor->x, ch, char_width, self->cursor, false);
self->cursor->x++;
if (char_width == 2) {
line_set_char(self->linebuf->line, self->cursor->x, 0, 0, self->cursor);
line_set_char(self->linebuf->line, self->cursor->x, 0, 0, self->cursor, true);
self->cursor->x++;
}
self->is_dirty = true;