Subject: Re: bug#13399: 24.3.50; Word-wrap can't wrap at zero-width space U-200B

From: Eli Zaretskii <[email-masked]>
Date: Thu, 10 Jan 2013 21:15:04 +0200

> Date: Thu, 10 Jan 2013 09:29:25 +0100
> From: martin rudalics <[email-masked]>
> 
> With emacs -Q evaluate
> 
> (with-current-buffer (get-buffer-create "*foo*")
>    (dotimes (i 1000)
>      (insert "1234​")) ; U-200B
>    (setq word-wrap t)
>    (display-buffer "*foo*"))
> 
> where the character after 1234 is a zero-width space character with
> unicode code point U-200B.  As can be seen in the window showing *foo*,
> lines are not regularly wrapped at that character.

You mean, not wrapped at all.  Witness the continuation bitmaps in the
fringes, which shouldn't appear when a line is wrapped.

> Doing
> 
> (with-current-buffer (get-buffer-create "*foo*")
>    (dotimes (i 1000)
>      (insert "1234 "))
>    (setq word-wrap t)
>    (display-buffer "*foo*"))
> 
> instead wraps lines as expected.

If anything, this is a missing feature, since word-wrap is explicitly
coded to break lines only on SPC and TAB characters.  See the
IT_DISPLAYING_WHITESPACE macro in xdisp.c.

If we want to add more characters to the set, we should probably
arrange a special char-table for this, and have it exposed to Lisp, so
it could be customized.  Patches are welcome.