Ben Fritz write:

> I use the delimitMate plugin by Israel Chauca Fuentes:
> 
>   http://www.vim.org/scripts/script.php?script_id=2754
>   https://github.com/Raimondi/delimitMate
> 
> I found this plugin to be "the best" at automatically inserting the
> closing character for "paired" characters like (..), [..], etc. It is
> customizeable, and until recently, did not affect undo/redo/repeat.
> 
> But, this plugin uses setline() internally, taking advantage of the
> "bug" fixed recently, that calling setline() in insert mode does not
> break the undo sequence. So, in Vim 7.3.1169, I can type the following:
> 
>   aone two three<Esc>
> 
> Pressing 'u' would undo the entire insertion. With 7.3.1298, pressing
> 'u' removes each word individually, because <Space> triggers some logic
> in delimitMate.
> 
> It is even more annoying when delimitMate actually inserts anything.
> Typing the following with delimitMate installed:
> 
>   aone two(three<Esc>
> 
> Will actually insert the text:
> 
>   one two(three)
> 
> So far, so good. Pressing '.' to repeat likewise still works. But when
> pressing 'u', in 1169 the entire insert is undone. In 1298, the first
> press gets rid of three) and the second press gets rid of the rest.
> 
> Similar problems also occur when using the mapping to skip past an
> existing ) instead of inserting a new one when pressing ) in insert
> mode.
> 
> I think, what is needed, is a method in insert mode, to insert text
> after the cursor and/or move the cursor, without breaking the undo
> sequence. The setline() thing was always a hack, I admit.
> 
> Oddly it looks like Israel's name is on the 7.3.1200 issue description,
> so presumably he's aware of this. But the latest version of his plugin
> from GitHub breaks as described. And honestly I think it somewhat
> strange that I need a complicated plugin using setline(), etc. to avoid
> breaking undo/redo for something as simple as inserting an extra ) while
> typing in insert mode, or moving the cursor beyond the ) when typing a
> new one.

Perhaps we can somehow detect that CTRL-R = had the side effect of
changing the text and then split undo.  When it only returns the text to
be inserted, there is no need to split undo.

Does the delimitMate return the text to be inserted or does it use
setline()?  In the last case it can't be fixed really.

-- 
My girlfriend told me I should be more affectionate.
So I got TWO girlfriends.

 /// 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].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui