unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: 3452@emacsbugs.donarmstrong.com
Subject: bug#3452: 23.0.94; display
Date: Mon, 08 Jun 2009 10:51:14 +0900	[thread overview]
Message-ID: <E1MDU14-0000xn-M7@etlken> (raw)
In-Reply-To: <877hzoogc1.fsf@cyd.mit.edu> (message from Chong Yidong on Sat, 06 Jun 2009 23:47:26 -0400)

In article <877hzoogc1.fsf@cyd.mit.edu>, Chong Yidong <cyd@stupidchicken.com> writes:

> > 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.

There's no inconsistency.

On terminal, if a zero-width character doesn't follow a base
character, Emacs composes that character by prepending SPACE
hoping that the terminal treats that zero-width character as
zero-width too.  This is to make that character still
edittable (e.g. we can put cursor on it) in Emacs.

So, even if char-width-table says it's zero width, all Emacs
display routines including indent.c treat that character's
width as 1.

But, gnome-terminal doesn't treat that character as
zero-width.  Please make the file "temp" by this code:

(with-temp-file "~/temp" (insert #x202d ?a ?\n))

and do "% cat ~/temp" on gnome-terminal.

> 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?

fill_gstring_body (in composite.c) just initializes gstring.
The actual composition function
(compose-gstring-for-terminal on terminal) does the above
composition.

In article <E1MDEU1-0004sV-3H@fencepost.gnu.org>, Eli Zaretskii <eliz@gnu.org> writes:

> I think it would be a bad idea to set these characters to anything but
> zero width.

I agree with that.

> These characters are not supposed to be displayed at all,
> they have no meaningful glyphs to show them.  They are just directives
> to the bidirectional display engines about how to convert logical
> order of characters to visual order.

But as Emacs 23 doesn't support bidi, at least we should
make it edittable, don't we?

> Btw, I don't understand how these characters are related to
> compositions.  They should not be composed with anything, they always
> stand for themselves.

Currently they are not composed with any other surrounding
characters (but only with an artificially prepended SPACE),
so we can say that they stand for themselves.

To conclude, I think there's not that much we can do for
this situation.  I think the current behaviour of
gnome-terminal (displaying standalone U+202D as a space of
width 1) is a bug.

---
Kenichi Handa
handa@m17n.org





  parent reply	other threads:[~2009-06-08  1:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-07  3:47 bug#3452: 23.0.94; display Chong Yidong
2009-06-07  9:16 ` Eli Zaretskii
2009-06-07 13:56   ` Chong Yidong
2009-06-07 14:30     ` Eli Zaretskii
2009-06-07 20:41   ` Chong Yidong
2009-06-07 22:53     ` Eli Zaretskii
2009-06-08  1:51 ` Kenichi Handa [this message]
2009-06-08  4:48   ` Eli Zaretskii
2009-06-08  8:10     ` Kenichi Handa
2009-06-08  8:44       ` Eli Zaretskii
2009-06-08 11:57         ` Kenichi Handa
2009-06-08 14:47           ` Chong Yidong
2009-06-09 18:00           ` Chong Yidong
2009-06-10  0:35             ` Kenichi Handa
  -- strict thread matches above, loose matches on Subject: below --
2009-06-06  2:48 Chong Yidong
2009-06-03  2:53 Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=E1MDU14-0000xn-M7@etlken \
    --to=handa@m17n.org \
    --cc=3452@emacsbugs.donarmstrong.com \
    --cc=cyd@stupidchicken.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).