nvim-scrollview icon indicating copy to clipboard operation
nvim-scrollview copied to clipboard

Account for "virtual" lines after EOF

Open DanielCardonaRojas opened this issue 2 years ago • 2 comments

Hi @dstein64 thanks for making this plugin.

It would be nice to have a configuration option that allows accounting for extra scrolling lines after end of file. This way we can have a bit smaller scroll bar.

This is how VSCode show's this:

Screen Shot 2021-12-02 at 11 17 15 AM

Here's the same file open in a window about the same size as the previous VSCode one.

image

I've noticed in general nvim-scrollview renders pretty big bars, of course this is most notable in small files.

DanielCardonaRojas avatar Dec 02 '21 16:12 DanielCardonaRojas

My idea for handling scrolling past the end of the buffer:

Keep it the way it is now, but when the user starts to scroll past the end of the buffer, the scrollbar starts "sinking" down below the visible part of the track.

Please see how https://github.com/gcavallanti/vim-noscrollbar does this:

https://user-images.githubusercontent.com/4657140/165832030-d407da2b-d006-498c-b06a-7f775c10efcc.mov

In this video the horizontal scrollbar in the status line is from vim-noscrollbar (the vertical one is nvim-scrollview). Notice how once I scroll past the end of the buffer, the scrollbar "disappears" into the right. This makes sense in my head because the scrollbar represent the region of the buffer that is visible in the window. As I scroll past the end, the visible region shrinks, and so does the scrollbar.

Emacs does the same thing. Watch the scrollbar as I scroll past the end of the buffer:

https://user-images.githubusercontent.com/4657140/165985919-2fbd22c7-35d8-4126-ac87-bff8c9c9d2d3.mov

Asheq avatar Apr 28 '22 19:04 Asheq

BTW, @dstein64 this plugin is by far the best vim scrollbar plugin I've found! Really glad I found it, and thanks for the incredible work.

(I like being able to place the scrollbar on the left, since it's more within my peripheral vision)

Asheq avatar Apr 28 '22 19:04 Asheq

Thanks for the ideas @DanielCardonaRojas and @Asheq.

@DanielCardonaRojas, the functionality you proposed is now offered as an experimental feature. It can be enabled by setting g:scrollview_include_end_region to v:true.

@Asheq, the behavior you proposed is now the default. Scrollbars will overflow past the bottom of the window when showing the end region, after the last line, of a buffer. I was initially not able to reproduce the Emacs functionality you showed in the video (I tried on Ubuntu). When I tried on Mac and Windows, I could see the scrollbar overflow, as you showed. The behavior I implemented matches Emacs on Mac, where it's also possible to reach that state by dragging the scrollbar with the mouse. That was not possible on Emacs on Windows.

The updates were implemented in #95.

dstein64 avatar Jun 08 '23 04:06 dstein64