all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Matt McClure <matthewlmcclure@gmail.com>
Cc: 11341-done@debbugs.gnu.org
Subject: bug#11341: Feature request: make whitespace visible and keep lines	wrapped at word boundaries simultaneously
Date: Thu, 26 Apr 2012 13:53:58 +0300	[thread overview]
Message-ID: <83pqauix15.fsf@gnu.org> (raw)
In-Reply-To: <CAJELnLEghm-wmPL42NjkcDNUoH2GN6QwRL6AvhSbu0ffTVCDNA@mail.gmail.com>

> Date: Wed, 25 Apr 2012 09:37:43 -0400
> From: Matt McClure <matthewlmcclure@gmail.com>
> 
> > Date: Sun, 22 Apr 2012 20:29:44 -0400
> > From: Matt McClure <matthewlmcclure@gmail.com>
> >
> > When I turn on whitespace-mode in a buffer with word-wrap on, e.g., in
> > visual-line-mode, lines become wrapped at the right edge of the window
> > instead of word boundaries.
> >
> > How can I make whitespace visible and keep lines wrapped at word
> boundaries
> > simultaneously?
> 
> Customize whitespace-display-mappings so that the whitespace
> characters are displayed as themselves, instead of as fancy non-ASCII
> glyphs.  (You will still have the faces to show the whitespace.)
> 
> For a better solution, please file a feature-request bug report, this
> would require changes in the display engine.

Fixed in revision 108046 on the trunk (for Emacs 24.2).  The diffs are
below, if you don't want to wait.


=== modified file 'src/ChangeLog'
--- src/ChangeLog	2012-04-26 10:07:35 +0000
+++ src/ChangeLog	2012-04-26 10:49:29 +0000
@@ -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

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2012-04-20 08:48:50 +0000
+++ src/xdisp.c	2012-04-26 10:49:29 +0000
@@ -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.  */
 






      reply	other threads:[~2012-04-26 10:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-25 13:37 bug#11341: Feature request: make whitespace visible and keep lines wrapped at word boundaries simultaneously Matt McClure
2012-04-26 10:53 ` Eli Zaretskii [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83pqauix15.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=11341-done@debbugs.gnu.org \
    --cc=matthewlmcclure@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.