seagle0128 / doom-modeline

A fancy and fast mode-line inspired by minimalism design.
https://seagle0128.github.io/doom-modeline/
GNU General Public License v3.0
1.27k stars 157 forks source link

[Bug] buffer-position formatting won't respect flags in format specifier for column #691

Closed psionic-k closed 7 months ago

psionic-k commented 7 months ago

Thank you for the bug report

Bug description

Setting doom-modeline-position-column-line-format to ("%l:%-3c") for example, adding flags to the column format specifier, doesn't get respected. Very specifically, "%5c" will work bu t"%-3c" will not.

I think this is unrelated, but I noticed the string replacements here are assuming the specifiers have no flags: https://github.com/seagle0128/doom-modeline/blob/master/doom-modeline-segments.el#L1674-L1680C76

Steps to reproduce

(setopt doom-modeline-position-column-line-format '("%l:%-3c"))

Possibly some more to enable the column display.

Expected behavior

Right-padding added to the column number

OS

Linux

Emacs Version

29

Emacs Configurations

Custom

Error callstack

No response

Anything else

I worked around the issue using left padding for now to stabilize the width at low column numbers.

seagle0128 commented 7 months ago

Not sure if you need this

(setopt doom-modeline-position-column-line-format '("%l:%3c"))

And make sure column-number-mode and doom-modeline-column-zero-based are non-nil.

psionic-k commented 7 months ago

That's basically my "workaround" before resorting to advice. I'm rendering commands right after that figure and really need it to be a bit more stable.

seagle0128 commented 7 months ago

Did you check the behavior of emacs -Q and (setq mode-line-position-column-line-format '(" (%l,%-3c)"))? I am not sure what's your expected.

psionic-k commented 7 months ago

That was helpful. mode-line-position-column-format to (" C%-3c")

My only other complaint is that it's difficult to insert arbitrary items into the modeline, but I won't open an issue for that. I'm sure you're aware of the tradeoffs.