IngoMeyer441 / tmux-easy-motion

Vim's easy-motion for tmux
MIT License
81 stars 6 forks source link

Selection highlighting can be wrong with long lines #12

Closed butwerenotthereyet closed 3 years ago

butwerenotthereyet commented 3 years ago

If easy-motion is started in copy-mode when a selection (or block selection) is active, the selection is discarded. It would be neat to create selection using tmux-easy-motion to define the beginning and end.

IngoMeyer441 commented 3 years ago

Do you have an example? I am a bit suprised since I use tmux-easy-motion often to extend an active selection. Before commit 228a073b855e2aa8c2d4e6c29b4dcbb72c9880a4 the selection was cleared when the current pane was zoomed but this should be fixed now.

butwerenotthereyet commented 3 years ago

Not able to show example of original problem now, but here are some related issues. Maybe original problem has the same cause?

Cat a big file with long lines and go to top-left: 0

Start target-letter mode (s s in the image): 1

Target a letter (c) 2

Choose the first target letter (n in the image): 3

💥 The wrapping is funny. Did new characters get inserted rather than original characters being replaced?

Choose the second letter (s in the image): 4

Start a selection (space in the image): 5

Move a bit to see that selection is active (f space in the image): 6

Start target-letter mode (s s in the image): 7

Target a letter (l in the image): 8

Choose the first target letter (f in the image): 9

Choose the second letter (e in the image): 10

💥 Highlighting is funny. Is this from long lines getting longer?

Move up a line or two: 11 12

Then move down: 13

💥 Highlighting is funnier.

Moving down over the end of the fake highlighting fix the problem: 14 15

butwerenotthereyet commented 3 years ago

Updated title to be accurate.

IngoMeyer441 commented 3 years ago

Ok, I think I found the problem. Multiple targets with the same text position were printed one after another which led to a text shift (for example when searching for c in occaecat). Now targets with the same text position are sorted and only the first target is shown on screen (commit a8d4ddc68eaca07a79704aca082a85687d629984).

IngoMeyer441 commented 3 years ago

That should also fix the weird selection rendering issues.

butwerenotthereyet commented 3 years ago

This is fantastic! Thank you!! (I repeated the steps above and the bug is fixed.) The long line extending had other effects too like making tmux-easymotion hard to use when scrolled--that's fixed too!

IngoMeyer441 commented 3 years ago

Thanks for reporting and testing!

IngoMeyer441 commented 3 years ago

Hopefully, it is now ready for use in the daily workflow. :smile: