Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Dec 2013 05:47:27 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r259761 - head/sys/teken
Message-ID:  <201312230547.rBN5lRU8017003@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312230547.rBN5lRU8017003>