Tuesday, June 19, 2012

Re: mswin: problem with C-S after C-X,C-O

On Monday, June 18, 2012 1:48:39 PM UTC-5, Bram Moolenaar wrote:
> Philip Mat (?) wrote:
>
> > In Vim 7.3 mswin.vim defines `inoremap <C-S> <C-O>:update<CR>`, which
> > causes problems when pressed shortly after a <C-X><C-O> combination
> > because the auto-completed text will now read :update + newline
> > instead of saving the file. The problem is caused by the <C-O> which
> > undoes the autocomplete item instead of the typical <C-O> behavior.
> >
> > How to reproduce:
> >
> > 1. In an XML file type <Tag></
> > 2. Type <C-X><C-O> => the content now reads <Tag></Tag>
> > 3. Within a short amount of time, type <C-S> => the content now reads
> > <Tag></:update
> >
> > (4. if you undo, it undoes the whole line)
> >
> > I think that maybe a better map would be `inoremap <C-S> <Esc>:update<CR>a`?
> >
> > Is this a bug and if so, where do I file a bug report?
>
> You just did.
>
> I wonder if leaving Insert mode and then entering again causes different
> problems?
>

I know we can use pumvisible() to check if the completion menu is active, so maybe we can use an expression mapping which ends the completion if it's active before using the rest of the mapping.

But I'm not sure this works if the user doesn't have menu or menuone in their completion options.

--
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

No comments: