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.

-- 
If all you have is a hammer, everything looks like a nail.
When your hammer is C++, everything begins to look like a thumb.
                        -- Steve Hoflich, comp.lang.c++

 /// 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/201905131844.x4DIiKou010605%40masaka.moolenaar.net.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui