Comments (8)
I have just merged the change, I think it's the only way we can get any sort of feedback. Let's wait and see what happens.
from lf.
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?
Solution | Description |
---|---|
Change number /relativenumber to display line numbers on the main window only |
This is a breaking change, and some users may not like this. However since I don't really use this feature much, I don't know which one is more preferred and I am probably indifferent about this anyway. |
Change number from a boolean option to a string (e.g. all /active /off ) |
This may end up being slightly unintuitive because the corresponding option in Vim is boolean. It is also a breaking change since users who have set number true will have the change it to set number all to maintain the existing behavior. |
Add another boolean option to control whether line numbers are displayed on all windows or the main window only | This won't result in a breaking change, but would introduce another option and there are a lot of them already. |
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.
from lf.
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.
from lf.
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 lf
has a lot of options already. The problem with UI configuration in general is that every user has their own preference for how things should be displayed and it's practically impossible to satisfy everyone 100% without adding a heap of options.
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 joshuto
(set the line_number_style
option) and it also displays line numbers on the main window only.
from lf.
I've submitted a PR for this #1752
from lf.
Fixed via PR #1752
from lf.
So just an update on this, the PR #1752 was closed because I deleted my fork to test something unrelated.
Although I rarely use line numbers myself, I have so far been reluctant to make any breaking changes without providing a way to keep the original behavior. Especially for anything relating to the UI display, which tends to be very subjective and based on user preferences. I am still a bit concerned that making this kind of change will just lead to someone else raising an issue to request it being reverted.
At the same time I am not sure whether it is a good idea to add more configuration options for minor things like this. I looked over the documentation just now and found that there are already a large number of options purely for configuring the display:
borderfmt
copyfmt
cursoractivefmt
cursorparentfmt
cursorpreviewfmt
cutfmt
drawbox
errorfmt
icons
info
infotimefmtnew
infotimefmtold
numberfmt
preview
promptfmt
ratios
roundbox
rulerfmt
selectfmt
statfmt
tagfmt
timefmt
truncatechar
truncatepct
At some point it becomes overwhelming for both users and maintainers. Going off on a tangent, I can see a possibility that someone in future will request the ability to separately color different types of line numbers (i.e. CursorLineNr
, LineNrAbove
and LineNrBelow
in Vim).
Anyway to address this particular issue, since multiple users have now requested this, I think it is probably better to proceed with this change. However if there is negative feedback from other users, then I will have to revert it until there is a better solution.
from lf.
I for one discovered this option by complete accident while going through the manpage, and my first thought was wanting the numbers in only the central column - partially because the others are fairly useless, and partially for the visual clutter.
Of course, if, as you suggested, some negative feedback does arise, then we could revert and reconsider our approach.
from lf.
Related Issues (20)
- Preview window colors HOT 14
- Yank path w/filename, filename, and file (As in Ranger) in Powershell HOT 6
- [QUESTION] Paste with overwrite for multiple files HOT 5
- Outdated file information for recreated directories HOT 9
- directories have another font type HOT 2
- Feature request: highlighting of cursors when inactive HOT 3
- Feature request: add an lfrc switch to move duplicate copy suffixes at the beginning of filename. HOT 4
- `autoquit` should be enabled by default HOT 6
- how to use fribidi within lf.
- sixel preview writes out of bounds
- Broken characters of dir when I use `-print-last-dir` option / change drive option `/d` in `lfcd.cmd` HOT 3
- Issue with scrolling using alt key HOT 6
- Feature request: precalculate previews for files around the cursor HOT 3
- lf does not open terminal text editor when going right HOT 4
- Multishell/Crossplatform handling of `--` HOT 3
- how to use `lf -remote` in cmd? HOT 3
- Downdir command? HOT 2
- Is there a way to select a directory for --print-selection and --selection-path? HOT 3
- Is it possible decide weather to the working dir AFTER enter `lf`? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lf.