Subject: bug#77452: closed (Re: bug#77452: 31.0.50; Wide characters in left margin on ttys)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 02 Apr 2025 17:30:02 +0000

Your bug report

#77452: 31.0.50; Wide characters in left margin on ttys

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
77452: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77452
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#77452: 31.0.50; Wide characters in left margin on ttys
From: Eli Zaretskii <[email-masked]>
To: Gerd Möllmann <[email-masked]>
Cc: [email-masked]
Date: Wed, 02 Apr 2025 20:29:48 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Gerd Möllmann <[email-masked]>
> Cc: [email-masked]
> Date: Wed, 02 Apr 2025 17:22:24 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> Cc: [email-masked]
> >> Date: Wed, 02 Apr 2025 17:47:47 +0300
> >> From: Eli Zaretskii <[email-masked]>
> >>
> >> > 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.
> >>
> >> Does the below look right to you?
> >
> > Sorry, please try the slightly more safe change below:
> 
> Thanks! LGTM, and it fixes the problem.

Thanks, installed on master, and closing the bug.

Subject: 31.0.50; Wide characters in left margin on ttys
From: Gerd Möllmann <[email-masked]>
To: [email-masked]
Date: Wed, 02 Apr 2025 11:52:46 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin24.3.0, NS
 appkit-2575.40 Version 15.3.2 (Build 24D81)) of 2025-04-02 built on
 pro2
Repository revision: 71b3298c0e813ba1432e75370c460eea5caf72d5
Repository branch: master
System Description:  macOS 15.3.2