svn commit: r259761 - head/sys/teken

Ed Schouten ed at FreeBSD.org
Mon Dec 23 05:47:28 UTC 2013


Author: ed
Date: Mon Dec 23 05:47:27 2013
New Revision: 259761
URL: http://svnweb.freebsd.org/changeset/base/259761

Log:
  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

Modified:
  head/sys/teken/teken_subr.h

Modified: head/sys/teken/teken_subr.h
==============================================================================
--- head/sys/teken/teken_subr.h	Mon Dec 23 04:38:56 2013	(r259760)
+++ head/sys/teken/teken_subr.h	Mon Dec 23 05:47:27 2013	(r259761)
@@ -840,13 +840,18 @@ teken_subr_regular_character(teken_t *t,
 			}
 			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);


More information about the svn-src-all mailing list