Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a strange space on the number line gutter #16314

Closed
winsphinx opened this issue Mar 18, 2024 · 7 comments
Closed

a strange space on the number line gutter #16314

winsphinx opened this issue Mar 18, 2024 · 7 comments
Assignees

Comments

@winsphinx
Copy link
Contributor

winsphinx commented Mar 18, 2024

On line is <= 31, there's no space before gutter, but when line number is >= 32, a space appears. It's strange, what happens on line 32?

image

@bcc32
Copy link
Contributor

bcc32 commented Mar 21, 2024

Spacemacs is just enabling the built-in line numbering logic in Emacs, like so:

(prog1 (display-line-numbers-mode)
            (setq display-line-numbers 'relative))

I suspect this is a bug in Emacs itself. Are you able to reproduce this using emacs -q (and with the above Elisp snippet)?

@winsphinx
Copy link
Contributor Author

winsphinx commented Mar 23, 2024

On original emacs -q mode, there is NOT the bug: BOTH have the space ahead.

image

@smile13241324
Copy link
Collaborator

I am sorry but I am completely at a loss what you mean, can you provide some more detailed instructions on what is wrong and how to reproduce it? Also please post your system details which you can obtain via spacemacs/report-issue.

Given from what you have written I assume there is an issue with automatically added blanks, this could be caused by dotspacemacs-use-clean-aindent-mode being non-nil in your dotfile. The package this setting refers to is very old and can cause such issues in more modern modes, please disable it in your dotfile and post if the issue persist.

Thanks.

@winsphinx
Copy link
Contributor Author

winsphinx commented Mar 31, 2024

Thanks.

I tried to set dotspacemacs-use-clean-aindent-mode to nil (according to the .spacemacs.template, default is t) and reomve the package clean-aindent-mode, but it still shows the bug:

repoducing steps:

  1. set line number mode to visual-line-mode;
  2. move the cursor to the line < 30L, it seems correctly: no blank before the line number;
  3. move down the cursor to > line 30+, obviously a space appears. Move up and down, the blank goes away and comes back;

Then according to @bcc32's post, I tried his code in emacs -q, i saw a leading blank appears on every line.

no matter if there are blanks or not, I wish it remains consistent when moving up and down.

@bcc32
Copy link
Contributor

bcc32 commented Mar 31, 2024

@smile13241324, the spaces appear visually (that is to say, not in the buffer itself) in the left margin, just left of the line numbers. Basically, the width of the numbers is inconsistent when scrolling through the buffer, which is pretty weird. I haven't figured out what causes this, yet.

@bcc32
Copy link
Contributor

bcc32 commented Mar 31, 2024

I was able to get Emacs to display more spaces than necessary, even when using emacs -Q. It attempts to set the width based on the widest line number it might have to show in the window, and this involves some heuristics, which may occasionally have errors. If this behavior bothers you, I would advise customizing the variables in the "Display Line Numbers" group (SPC SPC customize-group RET display-line-numbers RET

For example, setting display-line-numbers-width-start to t ("Minimum width for buffer's line count: on") will cause it to be computed once, up front, for each buffer, and never resized.

@smile13241324
Copy link
Collaborator

Then this is an emacs issue. I am going to close this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants