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

Display zero when relativenumber is enabled #1171

Merged
merged 1 commit into from Mar 25, 2023
Merged

Display zero when relativenumber is enabled #1171

merged 1 commit into from Mar 25, 2023

Conversation

joelim-work
Copy link
Collaborator

Regarding the formatting of line numbers, I think it's simpler and more readable to just pass in lnwidth as an argument to the format specifier, as opposed to building an intermediary format string.

Also I don't think it's necessary to specify precision for integers, so I have removed it. In fact, this was probably why the original pull request #133 didn't display a zero when relativenumber is enabled - I have found that fmt.Sprintf("[%1d]", 0) results in [0] while fmt.Sprintf("[%1.d]", 0) results in [ ].

@joelim-work
Copy link
Collaborator Author

Also, I do intend to slow down on pull requests after this one, for my own sanity. Apologies for all the recent spamming 😅

@gokcehan
Copy link
Owner

@joelim-work vim also seems to display 0 so I guess it is better to do the same here. Thanks for the patch.

Also thanks for all the patches so far. I don't remember anything controversial so they did not feel like spam at all. I'm sure many other users also appreciate your contributions. So feel free to send more patches any time you feel like in the future but also keep your sanity at the same time of course :)

@gokcehan gokcehan merged commit 6ffc4a4 into gokcehan:master Mar 25, 2023
3 checks passed
@shabahengam
Copy link

I know that there is no need to set number if we have relativenumber but if I put this in lfrc

set number
set relativenumber

then there is no 0 and if I remove set number then there is 0.is this normal?
ps: right now I can't attach image file to show what I mean.sorry for that

@joelim-work
Copy link
Collaborator Author

joelim-work commented Mar 26, 2023

Hi @shabahengam, it is perfectly valid to define both number and relativenumber at the same time. If number is enabled in addition to relativenumber, then the actual line number will be displayed for current line, and in this case the fix for displaying 0 is not relevant. This behaviour is consistent with Vim.

@joelim-work joelim-work deleted the relativenumber-zero branch March 26, 2023 01:50
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

Successfully merging this pull request may close these issues.

None yet

3 participants