bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57607: Feature request: Use the character cell on bottom-right corne


From: Eli Zaretskii
Subject: bug#57607: Feature request: Use the character cell on bottom-right corner of a terminal
Date: Tue, 04 Oct 2022 15:54:48 +0300

> From: Akib Azmain Turja <akib@disroot.org>
> Cc: 57607@debbugs.gnu.org,  gerd.moellmann@gmail.com
> Date: Tue, 04 Oct 2022 18:00:57 +0600
> 
> > Please try with some 2-column CJK characters, I'm not sure the example
> > with ^L is relevant here.  You can find the list of wide characters in
> > characters.el (search for "width"); for example, characters in the
> > U+FF00 block can be useful.
> 
> Thanks, "CJK STROKE D" doesn't work as expected, and the result depends
> on terminal in use.  How can I determine the width of a glyph?

Like this:

  (char-width CHAR)

where CHAR is the character you are interested in.  For example:

  (char-width #x31D4)
   => 2

>From C, you can call char_width, like Fchar_width (which see) does.

One other subtle point: the argument STRING to tty_write_glyphs is a
string of 'struct glyph' objects, not a string of characters.  Each
struct glyph has the code of the character to display in its u.ch
member, if the glyph is a simple character glyph; for the full story
see encode_terminal_code.

> > (And the existing code could have bugs,
> > no need to assume it is always correct.)
> 
> Yes, it can, but in most cases, my brain has more bugs.

Indeed, that the existing code has bugs should not be our first
hypothesis.  But it shouldn't be axiomatic that there are no bugs
there ;-)

> > face_id is an integer, and zero is a valid value (it means the default
> > face), so NULL won't do.  But you can use -1 to mean "no face ID".
> > Just make sure you never pass it to FACE_FROM_ID etc.
> >
> > Thanks.
> 
> OK, I'll try that.  Thanks.

TIA





reply via email to

[Prev in Thread] Current Thread [Next in Thread]