diff options
author | ed <ed@FreeBSD.org> | 2013-12-23 05:47:27 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2013-12-23 05:47:27 +0000 |
commit | ea48f0ae85a0dd01e413d878419d513488931994 (patch) | |
tree | 9d1762b23093ffa60f561d3037ca57caa1fa86dc /sys/teken | |
parent | aa956116c1d2e2f0ac93b94b87dc9fd3a4c57488 (diff) | |
download | FreeBSD-src-ea48f0ae85a0dd01e413d878419d513488931994.zip FreeBSD-src-ea48f0ae85a0dd01e413d878419d513488931994.tar.gz |
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
Diffstat (limited to 'sys/teken')
-rw-r--r-- | sys/teken/teken_subr.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/teken/teken_subr.h b/sys/teken/teken_subr.h index be3ce8a..2eee627 100644 --- a/sys/teken/teken_subr.h +++ b/sys/teken/teken_subr.h @@ -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); |