> > Again, apologies if I'm missing something obvious here.
>
> This is not inserting a line but splitting a line.  There could be text
> after the insertion point, which moves to the next line when pressing
> Enter.  In your case there might be nothing, but that doesn't cause a
> different change item.  You can see "lnum" and "end" are not the same
> here, meaning that this line might be changed.

Bram - that makes total sense, thanks very much for your patience.

One further issue I'm seeing relates to how undos are processed.

Now with the following:

function EchoChanges(bufnr, start, end, added, changes)
  redir >> /tmp/listener.log | echom getbufline(a:bufnr, 0, "$")
a:changes | redir END
endfunction
call listener_add("EchoChanges")

loaded via -u, with an initial file of:

Line 1
Line 2 #
Line 3
Line 4 #
Line 5
Line 6 #

and then executing the following commands:

:g/#/d
u

I see the following log line for the global command (which makes sense):

['Line 1', 'Line 3', 'Line 5'] [{'lnum': 2, 'col': 1, 'added': -1,
'end': 3}, {'lnum': 3, 'col': 1, 'added': -1, 'end': 4}, {'lnum': 4,
'col': 1, 'added': -1, 'end': 5}]

And then the following sequence as a result of the undo:

['Line 1', 'Line 3', 'Line 4 #', 'Line 5', 'Line 6 #'] [{'lnum': 4,
'col': 1, 'added': 1, 'end': 4}]
['Line 1', 'Line 2 #', 'Line 3', 'Line 4 #', 'Line 5', 'Line 6 #']
[{'lnum': 3, 'col': 1, 'added': 1, 'end': 3}]
['Line 1', 'Line 2 #', 'Line 3', 'Line 4 #', 'Line 5', 'Line 6 #']
[{'lnum': 2, 'col': 1, 'added': 1, 'end': 2}]

Now I'm guessing the undo is being processed step-by-step (so to
speak) in reverse.

So the first and second lines look wrong, because they appear to show
the buffer already has the "next" undo applied.

Again, apologies if (as is likely) I'm missing something obvious.

Thanks

-- 
-- 
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/CACoUkn5ndNDTLWff_kK_wyB8dQuLXo1CC5Mt0x_LQm0ZrNbGhw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui