Paul Jolly wrote:
> > Up to you. You can merge the changes into one, keeping the lowest
> > changed line number and the total deleted/added lines, or you can deal
> > with each change separately.
>
> I'm not sure I see how the change can be handled separately (without
> carrying forward position changes) in my case because it's only the
> combined result of the two changes that tells me I also need to
> include line 3.
>
> The first change:
>
> {'lnum': 1, 'col': 12, 'added': 1, 'end': 2}
>
> tells me I need to change line 1 in my plugin's version of the buffer,
> and then I should insert line 2 from the current buffer state after
> line 1 in my plugin's version of the buffer.
Hmm, that is not right, since after this change the second line would be
the terminating quote.
> The second change:
>
> {'lnum': 2, 'col': 1, 'added': 1, 'end': 2}]
>
> tells me I also need to insert line 2 from the current buffer before
> line 2 in my plugin's version of the buffer.
>
> Both read from the buffer in the current state, which means I end up
> with two blank lines instead of a blank line followed by a line with a
> single backtick
I see. So one would argue that the second change makes the "end" lnum of
the first change invalid, thus the changes would need to be flushed
first.
> > Your loop has a clear problem, that if you get two changes, one deleting
> > a line and one adding a line, then the l:change.type will get the last
> > change type, which depends on the ordering, so that won't work. The
> > easiest would be to deal with each change separately. Thus just before
> > the "endfor".
>
> Thanks, there are I'm sure a few issues that need to be resolved given
> my new understanding of the way things work :)
>
> I think I've got an idea of how I should be handling this now.
>
> Thanks again for your patience and taking the time to walk me through it.
Thanks for reviewing with an actual implementation.
--
hundred-and-one symptoms of being an internet addict:
14. You start introducing yourself as "Jim at I-I-Net dot net dot au"
/// 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/201905222113.x4MLDkp8010738%40masaka.moolenaar.net.
For more options, visit https://groups.google.com/d/optout.