Israel Chauca wrote:

> I found the following, open vim and do the following:
> 
> - Insert 1 and exit insert mode.
> - Append 2 and then <C-R>=setline('.', '123')<CR> to add one char to
>   the right of the cursor.
> - Without leaving insert mode, type other <CR> and the number 4, now
> exit insert mode.
> - Press u.
> 
> I should expect to have just the number 1 in the window, but I'm left
> with two lines:
> 
> 1
> 43

That indeed looks like a bug.

> If I undo again, I get the original empty window.
> 
> If I start in the second step, I can't undo to the empty window, I'm
> left with two lines but I can exit vim as if the buffer was in its
> original state.

I don't see this problem.

> Is that the expected behaviour or there is something wrong? why does
> the setline() call + <CR> affects the first edit?

A whole insert should be one undo step.  But when you invoke setline()
this is messed up.  Evaluating the expression was not supposed the side
effect of changing the text.

-- 
"You know, it's at times like this when I'm trapped in a Vogon airlock with
a man from Betelgeuse and about to die of asphyxiation in deep space that I
really wish I'd listened to what my mother told me when I was young!"
"Why, what did she tell you?"
"I don't know, I didn't listen!"
                -- Arthur Dent and Ford Prefect in Douglas Adams'
                   "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_use" 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

Reply via email to