]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow word wrap together with whitespace-mode (bug #11341)
authorEli Zaretskii <eliz@gnu.org>
Thu, 26 Apr 2012 10:49:29 +0000 (13:49 +0300)
committerEli Zaretskii <eliz@gnu.org>
Thu, 26 Apr 2012 10:49:29 +0000 (13:49 +0300)
 src/xdisp.c (IT_DISPLAYING_WHITESPACE): In addition to the loaded
 display element, check also the underlying string or buffer
 character.

src/ChangeLog
src/xdisp.c

index 8b23806e57f2ef78a30a87c981e30b65ba43f22b..df0e6135498c652c5f35800a855b084cca1e7618 100644 (file)
@@ -1,5 +1,9 @@
 2012-04-26  Eli Zaretskii  <eliz@gnu.org>
 
+       * xdisp.c (IT_DISPLAYING_WHITESPACE): In addition to the loaded
+       display element, check also the underlying string or buffer
+       character.  (Bug#11341)
+
        * w32menu.c: Include w32heap.h.
        (add_menu_item): If the call to AppendMenuW (via
        unicode_append_menu) fails, disable Unicode menus only if we are
index 3cbd4b172f4a861594a0afb1defca2ba11d089ff..f2700bd6d2592adcc2a06b5a420883ec71c9a9d2 100644 (file)
@@ -383,11 +383,21 @@ static Lisp_Object Qline_height;
 #define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) 0
 #endif /* HAVE_WINDOW_SYSTEM */
 
-/* Test if the display element loaded in IT is a space or tab
-   character.  This is used to determine word wrapping.  */
-
-#define IT_DISPLAYING_WHITESPACE(it)                           \
-  (it->what == IT_CHARACTER && (it->c == ' ' || it->c == '\t'))
+/* Test if the display element loaded in IT, or the underlying buffer
+   or string character, is a space or a TAB character.  This is used
+   to determine where word wrapping can occur.  */
+
+#define IT_DISPLAYING_WHITESPACE(it)                                   \
+  ((it->what == IT_CHARACTER && (it->c == ' ' || it->c == '\t'))       \
+   || ((STRINGP (it->string)                                           \
+       && (SREF (it->string, IT_STRING_BYTEPOS (*it)) == ' '           \
+           || SREF (it->string, IT_STRING_BYTEPOS (*it)) == '\t'))     \
+       || (it->s                                                       \
+          && (it->s[IT_BYTEPOS (*it)] == ' '                           \
+              || it->s[IT_BYTEPOS (*it)] == '\t'))                     \
+       || (IT_BYTEPOS (*it) < ZV_BYTE                                  \
+          && (*BYTE_POS_ADDR (IT_BYTEPOS (*it)) == ' '                 \
+              || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t'))))         \
 
 /* Name of the face used to highlight trailing whitespace.  */