xplr icon indicating copy to clipboard operation
xplr copied to clipboard

Optimize scrolling UI

Open maximbaz opened this issue 3 years ago • 4 comments

$ cd "$(mktemp -d)"
$ for i in `seq 0 1000`; do echo $i > $i; done
$ xplr

I expect xplr to show as much files as it could possibly fit, but in fact there is a lot of empty unused space:

image

If I begin to scroll down, it's not using more space:

image

If I resize terminal such that there is less vertical space, xplr even adjusts on the fly - but if I resize back, at some point it just stops using extra space, resulting in the pictures above.

It would be nice to always use all the available space 🙂

Furthermore, once you scroll down (like on the second picture above - so I'm on 946), and then I begin to scroll up again, I expect the cursor to go up but I expect 946 to still be in the view, i.e. view should not be scrolled at this point - like try scrolling up and down in vim in a long document, cursor goes up but screen scrolling should only begin when cursor reaches the top of the screen. Does this make sense? And what do you think in general? 🙂

maximbaz avatar Apr 12 '21 13:04 maximbaz

If I resize terminal such that there is less vertical space, xplr even adjusts on the fly - but if I resize back, at some point it just stops using extra space, resulting in the pictures above.

I forgot to make the limit dynamic. it's an easy fix.

cursor goes up but screen scrolling should only begin when cursor reaches the top of the screen.

This depends on https://github.com/fdehau/tui-rs/issues/328

sayanarijit avatar Apr 12 '21 14:04 sayanarijit

Just to clarify, it's not only about scrolloff (which would also be awesome btw), but in vim even with scrolloff=0, see how I can scroll to the bottom to line 40, and then I go back up but my "view" doesnt begin to scroll until on my way up my cursor reaches 20 and continues up?

record_1618237659

maximbaz avatar Apr 12 '21 14:04 maximbaz

Ah got it... Let me see how to implement this (without sacrificing performance).

sayanarijit avatar Apr 12 '21 14:04 sayanarijit

Reopening this as the navigation isn't vim-like yet.

sayanarijit avatar Apr 12 '21 16:04 sayanarijit

I think we have an easy and "good enough" scrolling system. Some plugins have adapted to this system to calculate the display area of the content in a layout. Making a stateful scrolling system will contribute to the complexity not only for xplr, but those plugins as well. So, being not interested in doing so, closing this issue.

sayanarijit avatar Apr 28 '23 13:04 sayanarijit

I'd really like to see this introduced. I believe XPLR is nearing perfection except for the current scrolling behavior which is so annoying and feels weirdly outstanding among all the CLI tools I regularly use.

ElSamhaa avatar Oct 27 '23 20:10 ElSamhaa