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

From: martin rudalics <[email-masked]>
Date: Fri, 11 Jan 2013 15:30:04 +0100

>> With emacs -Q I see curly arrows in the fringes regardless of whether I
 >> set `visual-line-fringe-indicators' or not.  What am I missing?
 >
 > If this is still with u+200B?  You need to try with regular spaces.

My bad.  It works when I enable `visual-line-mode'.  It doesn't with
only `word-wrap' set to t.

 > Then the indicators should disappear on wrapped lines.
[...]
 >> So `word-wrap' is ASCII-only?
 >
 > Yes.
 >
 >> The doc-string should say so.
 >
 > Well, I personally find it hard to imagine that "the space character"
 > could be interpreted as something other than U+0020.  But I see what
 > you mean.

Nothing serious.  I detected zero-width spaces and noticed that emacs
can display them, so I was mislead that word wrap would handle them.

 >> IIUC it has a `thin-space' display method entry and I could set this to
 >> `zero-width' (the doc-string of `glyphless-char-display' is ambiguous
 >> about that)?
 >
 > Yes.

Good.

 >>  Does this also mean that I can separate text properties of
 >> adjacent words by inserting a zero-width space between them?
 >
 > Yes, I think so (if I understand correctly what you mean).

Never mind, it works.  What I meant was that when, for example, I have
two adjacent parts of text with the same mouse-face property and the
mouse hovers over one of the words, the other word gets highlighted as
well.  Maybe it's just stickyness or whatever, but till now I hadn't
found a method to turn this off.  Not recommended for normal buffers
because `forward-char' appears to hang, but that's a different story.

 >> But implementing a character table and working with it is harder.
 >
 > I don't think it's harder, it's actually very simple.  You have a
 > simple API for setting values in the table and a simple API for
 > accessing a property of a character.

OK.  I take your word for it.  Maybe it could be also useful for adding
soft hyphens (if we can make `forward-char' handle them).

 >> Is it useful to make a _separate_ table for line-break properties?
 >
 > Why not?  What existing table would you reuse for that?

No idea.  Do we have a list of predefined character tables somewhere?

 >> Two functions: One to get the width of some arbitrary buffer text in
 >> pixels and one to get the full height of a buffer text line in pixels.
 >> The former would be used for doing word-wrapping variants in Lisp, the
 >> latter for fitting windows to their buffers.
 >
 > The latter already exists as window-line-height, doesn't it?

This needs an up to date display, IIUC :-(

 > Anyway, how would you word-wrap in Lisp, except by adding display
 > strings with newlines (which AFAIR features like longlines
 > etc. already do)?

By adding hard newlines.  All I care about is to (1) show the entire
buffer text in a fixed-width window and (2) make that window as small as
possible.

martin