-
Notifications
You must be signed in to change notification settings - Fork 319
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
Main Column Line Numbers Only #1751
Comments
Line numbers was requested in #130 and implemented in #133. I couldn't find any mention in the discussions about limiting the display to the main window, so I guess it was never considered at all. Actually this isn't hard to achieve, it should just be a one line change: diff --git a/ui.go b/ui.go
index f7684ec..7b9d3cb 100644
--- a/ui.go
+++ b/ui.go
@@ -385,21 +385,21 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
beg := max(dir.ind-dir.pos, 0)
end := min(beg+win.h, len(dir.files))
if beg > end {
return
}
var lnwidth int
- if gOpts.number || gOpts.relativenumber {
+ if (gOpts.number || gOpts.relativenumber) && dirStyle.role == Active {
lnwidth = 1
if gOpts.number && gOpts.relativenumber {
lnwidth++
}
for j := 10; j <= len(dir.files); j *= 10 {
lnwidth++
}
}
for i, f := range dir.files[beg:end] { The main problem is deciding on how this can be configured by users. Which one of the following do you prefer?
I'm leaning somewhere between the first and third options. Perhaps it's worth leaving this issue open so others can provide their opinions, but in the meantime you can use the above patch if you're willing to build from source. |
Thanks for the patch and detailed response. My vote would be option 1. I don't understand the need for line numbers in columns 1 or 3. Maybe for visual consistency? Option 3 works but feels oddly hyper specific of an option. |
After thinking about this a bit more, I sort of want to avoid adding too many new options (especially for something small like this) since I think what we can do is go with the first option, and then revisit this if there are users out there who want line numbers for every window. For reference, I tried |
I've submitted a PR for this #1752 |
When enabled, line numbers are in the left, center, and right columns:
![image](https://private-user-images.githubusercontent.com/50090107/341181549-27b86eb9-5bc1-4963-8e93-00b36241ff1b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MzYxNzQsIm5iZiI6MTcxOTYzNTg3NCwicGF0aCI6Ii81MDA5MDEwNy8zNDExODE1NDktMjdiODZlYjktNWJjMS00OTYzLThlOTMtMDBiMzYyNDFmZjFiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDA0Mzc1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTEyZGI0N2Q3OGY0OTdhNDAzN2MxMzgxNGU4NDE2Mjg1MjhjZTQwYjkxNTYyOTdjYzRlMjFlZjUxNTg5ZjA3NmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.mWijFeMoiwNyahQ3iaTtNSkCRCoIEZ2goYbGYOOtrB8)
However, I only use the main column line numbers to jump around with vim keybindings quicker. The other two columns of line numbers are unused, add visual clutter to parse, and shrink the usable width. An option is needed to only enable line numbers for the main column.
As an aside, this is in line with how ranger handles line numbers:
![image](https://private-user-images.githubusercontent.com/50090107/341183408-89b248c2-c189-44d3-a7f9-fd605dae41dd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MzYxNzQsIm5iZiI6MTcxOTYzNTg3NCwicGF0aCI6Ii81MDA5MDEwNy8zNDExODM0MDgtODliMjQ4YzItYzE4OS00NGQzLWE3ZjktZmQ2MDVkYWU0MWRkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDA0Mzc1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThmMzUxMjNmOTcyY2Q2ZTk0ODFiMDQ3ZGMxMWRkNDUyNDBiNjM5MTFiNWVkZTU0MTdlODk2MzZmN2FkOTliYzgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.xP3SxKde3Zn5tVZniJF5n3aTuD5-FL3SOMfbyQ73WJs)
The text was updated successfully, but these errors were encountered: