GNU bug report logs - #77452
31.0.50; Wide characters in left margin on ttys

Previous Next

Package: emacs;

Reported by: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Date: Wed, 2 Apr 2025 09:53:01 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77452 <at> debbugs.gnu.org
Subject: bug#77452: 31.0.50; Wide characters in left margin on ttys
Date: Wed, 02 Apr 2025 15:04:55 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
>> Date: Wed, 02 Apr 2025 11:52:46 +0200
>> 
>> in emacs -Q -nw, eval 
>> 
>>   (defun foo ()
>>     (interactive)
>>     (with-current-buffer (get-buffer-create "*foo*")
>>       (setq left-margin-width 2)
>>       (erase-buffer)
>>       (insert "abc")
>>       (insert (propertize "def" 'display '((margin left-margin) "1💡")))))
>> 
>> and M-x foo.
>> 
>> This creates a buffer "*foo*" displaying a string in a left
>> margin area of width 2. The string consists of 2 characters but has a display
>> width of 3 since the light bulb character has a display width of 2.
>> 
>>   (char-width ?💡)
>>    => 2
>> 
>> So, writing the left margin string to the terminal advances the output
>> cursor by 3 not 2. This confuses the display engine, as one can witness
>> by editing in the *foo* buffer, adding new lines etc.
>
> The problem is not the char-width of 💡 nor with advancement of the
> cursor, the problem is that the string "1💡" doesn't fit in the
> 2-column wide margin, and Emacs should have displayed only "1", since
> we cannot clip glyphs on TTY frames.

Exactly, that pretty much what I meant :-). The wide character may not
be output to the terminal, otherwise display and matrices get out of
sync.

> Are you going to work on fixing this long-time problem?  Or should I?

I tried to read and understand display_line etc. this morning, but I'm afraid
there is too much going on there for me to find the cause of this in
reasonable time.




This bug report was last modified 49 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.