Subject: bug#3452: 23.0.94; display

From: Chong Yidong <[email-masked]>
Date: Sat, 06 Jun 2009 23:47:26 -0400

> The problem stems from the character 8237 (#o20055, #x202d),
> LEFT-TO-RIGHT OVERRIDE.  For some reason, the composition for this
> character screws up line wrapping.

Hi Handa-san, I investigated some more.  Let me know what you think.

The entry for 8237 (#x202d) in char-width-table is 0: that is to say,
char-width-table reports that the composition has zero width.  This is
because of the following code in characters.el:

  (let ((l '((#x0300 . #x036F)
            ...
            (#x202A . #x202E)
            (#xE0001 . #xE01EF))))
    (dolist (elt l)
      (set-char-table-range char-width-table elt 0)))

The function fill_gstring_body in composite.c uses char-width-table.
However, composition_gstring_width for this character, called in
term.c:1830, returns 1.  This inconsistency leads to the bug.

Sure enough, if I do

  (aset char-width-table #x202d 1)

then the screen corruption goes away.

Maybe we should reconsider setting these characters to have zero-width
for char-width-table in characters.el, since fill-gstring-body seems to
handle zero-width compositions poorly.  WDYT?