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: Adriel Dumas--Jondeau
Subject: bug#61677: 30.0.50; Display-Fill-Column-Indicator mode shifts with narrow characters near end of line
Date: Tue, 21 Feb 2023 19:35:21 +0100

Thank you for your answer and these crystal clear explanations!

I have a much better understanding of what's happening now :)

Eli Zaretskii <eliz@gnu.org> writes:

> 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?

Yes, that's it! I didn't knew it was the “pitch” of the characters and
couldn't look it up online. Thank you for the pointer.

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

I assumed that this font should be available on most of systems as I
made nothing to get it installed. But this assumption is wrong.

I guess it should apply to any other variable-pitch font as well,
perhaps on different characters. Narrow nobreak-space should behave the
same on most of said fonts, though.

--- 8< ---

What I expect from display-fill-column-indicator is at least to be able
to tell at a glance whether the actual number of characters on a given
line goes beyond a certain point or not, independently from their size
with any given font. So having the indicator displayed even after I type
3 narrow nobreak-spaces at fill-column 1 bothers me a bit (as it should
disappear once it gets past the character count limit anyway). But I
also understand why we can't make it disappear based on the number of
characters, as the space between the text and the indicator wouldn't
represent the actual remaining empty characters in that case.

Whether this expectation is shared or not, and based on my current
knowledge, I think there's at least these three choices:

- Leaving things as is (The most straightforward and efficient way, and
  I would be absolutely okay with that)

- Is there any documentation somewhere about that? Adding a warning
  based on the current font pitch with a pointer towards a more detailed
  explanation on Display-Fill-Column-Indicator triggers (and maybe
  hooking it at frame-font changes). This would at least give some hints
  to users and would reduce the occurence of threads as the current one
  (Probably low effort unless there is doc to write about it).

- Modifying Display-Fill-Column-Indicator in order to display two
  vertical guides: the “global” vertical line that we currently have but
  with the catch that it should hold true for the current font pitch,
  pixel based, a single line at ~fill-column~ for normal characters,
  independent from the character count. A “character count” indicator,
  relative to each line, that may or may not be the same as the global
  one, with different glyph and color, doesn't show up if the same as
  the global one. It means the character count glyph may only be shown
  with a variable-pitch font on a line that contains narrowed or wide
  characters (This is the most controversial suggestion I'd say).

The benefit of the latter suggestion is that it still works the same
with fixed-pitch font (the character count should actually be the same
as the pixel size in this case), but it would be more expressive with
variable-pitch, thus fixing the inconsistencies that currently occur.

The caveat is it brokes the implicit rule that the indicator is about
the character count with variable-pitch font (as it would truly be about
taken physical space on the screen). But the fact that a new character
is displayed when it's not should (could?) make things clear.

I can make code suggestions for this last one (not right now though) if
nobody else is willing to, and if there's no real objection to it.

What do you think?

-- 
Adriel

Attachment: signature.asc
Description: PGP signature


reply via email to

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