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

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

bug#61677: 30.0.50; Display-Fill-Column-Indicator mode shifts with narro


From: Eli Zaretskii
Subject: bug#61677: 30.0.50; Display-Fill-Column-Indicator mode shifts with narrow characters near end of line
Date: Tue, 21 Feb 2023 17:00:29 +0200

> Date: Tue, 21 Feb 2023 12:40:45 +0100
> From:  Adriel Dumas--Jondeau via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> 1. Enable the Display-Full-Column-Indicator mode (~M-x di-i~).
> 
> 2. Conveniently set fill-column value to the lowest (~C-x f 1~).
> 
> 3. Set a font that properly displays narrow chars (~M-x s-fr-f~), e.g
>    "-PfEd-DejaVu Serif-regular-normal-normal-*-*-*-*-*-*-0-iso10646-1".
> 
> 4. Use a newline terminated line as the guide doesn't show up on the
>    last line of the file (e.g ~C-p~, ~C-o~ and whatnot).
> 
> 5. Insert some special characters, such as the narrow nobreak-space
>    (~C-x 8 RET 202f~), up to three times.
> 
> Observed behavior: The guide on this line is slightly shifted to the
> right in regards to the next and previous lines, and it get worse as
> narrow chars are added.

AFAIU, you are using a font that is effectively a variable-pitch font:
not all of the characters have glyphs of the same width, some have
narrower glyphs.  Is that correct?

If so, the display-full-column-indicator feature is not prepared to
deal with such fonts.  The whole notion of "fill-column" only makes
sense with fixed-pitch fonts, because otherwise either column N will
mean different pixel coordinates depending on which characters are
shown in the screen line (and the vertical line of indicators will
appear broken, unaligned), or (if we forcibly align the indicators on
the same pixel coordinate) the indicator will show a different column
on each line, again depending on what characters are shown in that
line.

What happens in your case is that the layout calculations performed by
the display engine go awry because this font's glyphs have different
widths, something the current code doesn't expect.  It should be
possible to modify the layout calculations so that the indicators
align on display on the same pixel, but then the number of the column
where the indicator is shown in each line will be different, which
basically makes this feature useless for its purpose.

So I think we won't fix this issue.  Unless I'm missing something,
that is.

Caveat: I don't have that font, so I used a different variable-pitch
font to see what happens.

> I don't know the internals of display-fill-column-indicator-mode, but my
> guts says that we should compensate this by using some another narrow
> characters (without any face) to properly align to fill-column.

On GUI displays, we don't use characters, we use a special stretch
glyph whose width we calculate as needed.  So that's not the problem.
The problem is that different characters produce glyphs of different
widths, and the code is not prepared to deal with that situations
because fill-column indicator only makes sense with fonts of fixed
width.





reply via email to

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