[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#1808: 23.0.60; picture-mode not considering double-width characters
From: |
Eli Zaretskii |
Subject: |
bug#1808: 23.0.60; picture-mode not considering double-width characters alignment |
Date: |
Sun, 10 Jan 2016 17:41:14 +0200 |
> From: Alan J Third <alan@idiocy.org>
> Date: Sat, 09 Jan 2016 22:43:36 +0000
> Cc: 1808@debbugs.gnu.org
>
> > This is not a new bug of EMACS 23; but it is there in EMACS22 for a
> > long time. In M-x picture-mode, emacs acts in a "replace" typing
> > mode, i.e. when you type a char, it replace the old one such that the
> > alignment is maintained.
> >
> > But when mixing with double-width characters (e.g. CJK chars), one to
> > one char replacing become problematic, e.g. if we replace a
> > single-width char with a double-wdith char, the alignment will be
> > destroyed.
>
> Sorry it's taken this long for someone to get back to you.
>
> First, do you know if this is still a problem for you?
I think I still see it in the current Emacs-25 branch.
> If so, how are you entering the CJK characters?
The point is double-width characters, not necessarily CJK character,
AFAIU. There's a list of such characters in
lisp/international/character.el (search for "full-width").
Typing any of the characters for which the char-width-table entry
holds 2 should exhibit the problem.
> I find in Emacs 25 that if I try entering a greek alpha by typing:
>
> C-x 8 RET GREEK SMALL LETTER ALPHA
>
> It inserts the character, however when I bind the same character to a
> key, eg.:
>
> (global-set-key (kbd "C-c a") "α")
>
> and enter it that way it works as expected.
Yes, binding it to a key is the way to go. And when inserting such a
character, it looks like picture-mode does TRT: you will see in
picture-insert that it looks at the character width. But I think the
bug report is not about inserting double-width characters, it's about
replacing them with a single-width character. If I type a
double-width character, the alignment is kept reasonably well
("reasonably" because the double-width characters don't always take up
exactly twice the number of pixels of a single-width character, the
exact ration depends on the font being used for the double-width
character). To keep the alignment, picture-insert replaces 2
single-width characters with the double-width one. However, if I then
replace it with a single-width character, the alignment is destroyed.
And I think this bug report is about that latter use case.
Thanks for working on this.