mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
Fix horizontal scrolling of textareas when UTF-8 I/O is enabled
As draw_textarea_utf8 loops over each character of the textarea content, it checks whether the character is on the screen; draws it if so; increments the screen co-ordinate; and updates the position in the textarea text. The last step was being skipped when the character was not on the line, so a line would be drawn from the beginning, even if the left edge of the textarea is off the screen. Closes: Bug 835 - Text in textarea is unaffected by horizontal scrolling of document in UTF-8 mode
This commit is contained in:
parent
5537a3f977
commit
711ee0a33f
@ -363,26 +363,25 @@ draw_textarea_utf8(struct terminal *term, struct form_state *fs,
|
||||
for (i = 0, x = xbase; i < fc->cols; i++, x++) {
|
||||
unicode_val_T data;
|
||||
|
||||
if (!col_is_in_box(box, x))
|
||||
continue;
|
||||
|
||||
if (i >= -fs->vpos && text < end) {
|
||||
int cell;
|
||||
|
||||
/* utf8_to_unicode will increment text. */
|
||||
data = utf8_to_unicode(&text, end);
|
||||
cell = unicode_to_cell(data);
|
||||
} else
|
||||
data = '_';
|
||||
|
||||
if (col_is_in_box(box, x)) {
|
||||
int cell = unicode_to_cell(data);
|
||||
|
||||
if (cell == 2) {
|
||||
draw_char_data(term, x++, y, data);
|
||||
i++;
|
||||
data = UCS_NO_CHAR;
|
||||
}
|
||||
|
||||
} else
|
||||
data = '_';
|
||||
|
||||
draw_char_data(term, x, y, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (; y < ye; y++) {
|
||||
int i;
|
||||
|
Loading…
Reference in New Issue
Block a user