mini.nvim icon indicating copy to clipboard operation
mini.nvim copied to clipboard

Add option to have cursor not animate to past the edge of the buffer when wrapping is enabled

Open WildRage1369 opened this issue 1 year ago • 2 comments

Contributing guidelines

Module(s)

mini.animate

Description

When wrapping is enabled, mini.animate animates the cursor as moving to past the edge of the buffer as if wrapping is disabled. An option to have a fix applied to work for wrapping would be great.

WildRage1369 avatar Feb 12 '24 20:02 WildRage1369

Thanks for the suggestion!

Yes, I've noticed it too and thought about fixing it. The problem here was to compute the proper target destination and proper intermediate places. As although the line is displayed wrapped, it isn't so internally (it is still a single line). So it would need some extra work with window views which are both not trivial and might be computationally (relatively) expensive.

I'll take a second look, though.

echasnovski avatar Feb 12 '24 20:02 echasnovski

The problem here was to compute the proper target destination and proper intermediate places. As although the line is displayed wrapped, it isn't so internally (it is still a single line). So it would need some extra work with window views which are both not trivial and might be computationally (relatively) expensive.

From some initial brainstorming I had the idea to do just a basic calculation where you check if the cursor position's column is greater than the width of the window then to do a calculation to get the displayed position rather than the internal position by subtracting the width from the column number. I am not sure exactly how this would be implemented but I hope it helps!

WildRage1369 avatar Feb 12 '24 21:02 WildRage1369