Closed andrewferrier closed 4 months ago
Error - four columns of whitespace are shown to the left of the file, but this doesn't make much sense.
'statuscolumn' follows the 'numberwidth' option. This is doucmented and did not change in #29357.
Error - four columns of whitespace are shown to the left of the file, but this doesn't make much sense.
'statuscolumn' follows the 'numberwidth' option. This is doucmented and did not change in #29357.
OK, it's possible that I got confused about the pull req having changed something; nevertheless, I don't think this behaviour makes much sense. Isn't the idea that statuscolumn
will override the complete drawing of the status column? In this case, the fact that %l
isn't part of the statuscolumn should surely mean that nothing is shown for line numbers, either them or whitespace for them?
In case I'm not being clear, I'm not talking about extra whitespace being shown next to line numbers, I'm talking about no line numbers being shown at all. I've attached an image in case it's not clear what I meant...
If you set '(relative)number', it is just assumed that the statuscolumn will contain line numbers, and thus follows 'numberwidth'. Nvim cannot reasonably determine whether that is the case, so if it is not, you must unset '(relative)number' if you don't want the extra padding for 'numberwidth'.
Can't we make %l
be empty (zero length) if both nu
and rnu
are unset?
It already is. But then if '(r)nu' is enabled the statuscolumn itself is padded to 'numberwidth', even if it doesn't contain %l
. This is what @andrewferrier finds unexpected but it is done deliberately because the statuscolumn may contain line numbers despite that through vim.v.(re)lnum
.
Ah ok, makes sense. This should be closed as intended then.
@luukvbaal so to summarize, I think what you're saying is that if number
or relativenumber
is set (or both), statuscolumn
will always pad by numberwidth
, even if %l
is missing, because the assumption is that any custom logic called from statuscolumn
will want to render numbers/relnumbers instead. I re-read the docs and whilst I don't think it's stated there quite that explicitly, all of this is kind of covered by the statuscolumn
description.
So that all makes some sense to me. I think you can close this, agreed. Thanks for your patience and all your hard work on NeoVim :)
Problem
Since pull request https://github.com/neovim/neovim/pull/29357 was merged into nightly, line numbers seem to have been interacting very strangely with
statuscolumn
and thenumber
option and additional whitespace is getting inserted. Explained through recreation below.Steps to reproduce
nvim --clean -u minimal.lua
:edit ~/anyfile.txt
:set statuscolumn=%s
:set number
statuscolumn
is responsible for drawing the line numbers, there is nothing instatuscolumn
which should do this - no%l
or any line-drawing logic. Ifnumber
is responsible for drawing line numbers (which I don't think is the intended behaviour ofstatuscolumn
), actual line numbers should be shown.Expected behavior
No additional whitespace shown to the left of the file.
Neovim version (nvim -v)
NVIM v0.11.0-dev-301+g6c3f7e7e2
Vim (not Nvim) behaves the same?
No
statuscolumn
option in VimOperating system/version
Arch Linux
Terminal name/version
kitty 0.35.1
$TERM environment variable
xterm-kitty
Installation
nvenv