I wrote:
> Paul Jolly wrote: > > > > Yesterday I sent out patch 8.1.1321 which adds listener_add(). > > > This makes it possible to find out about text changes and possibly > > > update text properties or anything else. > > > > Hi Bram - this is fantastic, thanks. I look forward to giving this a try > > with https://github.com/myitcv/govim and gopls. > > > > > Another thing is that the line numbers in the changes are valid for when > > the change is made. > > > > Understood. One relatively easy way to handle this is to handle the changes > > in reverse, i.e. by iterating through the list backwards. But I think this > > requires that the changes themselves be non-overlapping. > > > > From glancing at the documentation in > > https://github.com/vim/vim/commit/a334772967de25764ed7b11d768e8b977818d0c6 > > it appears that's the case, but I did just want to check. > > > > Please can you confirm? > > Not sure. In a script it's possible a lot of changes happen in > sequence, until the next redraw. So, give it a try. > > I was also wondering if we need a "flush" command for the changes, in > case a redraw is undesired but the listeners should be invoked. > > Another possibility is to automatically flush before adding a change > that is above a previous one AND it changes the line count. That's when > keeping track of line numbers becomes difficult. Note that if we go this way, then the text must be locked, since the callback would then happen somewhere during making changes. That probably isn't a problem, if the plugin is doing some highlighting or async server requests. If needed, the plugin could use a timer to be called back later to do further work. -- Looking at Perl through Lisp glasses, Perl looks atrocious. /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/201905131933.x4DJXVqX019192%40masaka.moolenaar.net. For more options, visit https://groups.google.com/d/optout.
