0xAdk / full_visual_line.nvim

Enhance neovim's visual line mode with fully highlighted lines
MIT License
30 stars 2 forks source link

Added vim.schedule so visual selections work with other pending text … #3

Closed ColinKennedy closed 8 months ago

ColinKennedy commented 8 months ago

Fixes https://github.com/0xAdk/full_visual_line.nvim/issues/2

By deferring the evaluation of full_visual_line.nvim, it gives time for other text object operators to execute first

Bad (current master branch)

https://github.com/0xAdk/full_visual_line.nvim/assets/10103049/3eb1a562-0d26-4190-aa16-0f0400640864

Fixed (this branch)

https://github.com/0xAdk/full_visual_line.nvim/assets/10103049/be7ebd87-dbce-49ba-8d75-0612646f32a8

0xAdk commented 8 months ago

I wonder why this fixes the issue, I always understood vim.schedule as "the thing you use with vim.loop." And would've thought in this case vim.schedule would be a no-op.

ColinKennedy commented 8 months ago

I wonder why this fixes the issue, I always understood vim.schedule as "the thing you use with vim.loop." And would've thought in this case vim.schedule would be a no-op.

vim.schedule places its function to the end of Vim's event queue and that functionality happens whether or not you're in vim.loop. Since we place the call at the end, it gets the most up to date view of the text object

0xAdk commented 8 months ago

thanks again, I doubt I would've be able to solve this with my previous understanding :p probably would've added some racy delay if I even fixed it at all.

ColinKennedy commented 8 months ago

It's my pleasure! Thank you for the quick and easy PR review :)