Fix linewrapping behaviour for CJK fullwidth characters.

Instead of only wrapping when in the 'wrapped state', also force
wrapping when the character to be rendered does not fit on the line
anymore.

Tested by:	lwhsu
This commit is contained in:
Ed Schouten 2013-12-23 05:47:27 +00:00
parent c807508f73
commit 67f2a03a7c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=259761

View File

@ -840,13 +840,18 @@ teken_subr_regular_character(teken_t *t, teken_char_t c)
}
t->t_cursor.tp_col = 0;
}
} else if (t->t_cursor.tp_col == t->t_winsize.tp_col - 1 &&
(t->t_stateflags & (TS_WRAPPED|TS_AUTOWRAP)) ==
(TS_WRAPPED|TS_AUTOWRAP)) {
} else if (t->t_stateflags & TS_AUTOWRAP &&
((t->t_stateflags & TS_WRAPPED &&
t->t_cursor.tp_col + 1 == t->t_winsize.tp_col) ||
t->t_cursor.tp_col + width > t->t_winsize.tp_col)) {
teken_pos_t tp;
/* Perform line wrapping. */
/*
* Perform line wrapping, if:
* - Autowrapping is enabled, and
* - We're in the wrapped state at the last column, or
* - The character to be printed does not fit anymore.
*/
if (t->t_cursor.tp_row == t->t_scrollreg.ts_end - 1) {
/* Perform scrolling. */
teken_subr_do_scroll(t, 1);