Christian Brabandt wrote: > On So, 14 Dez 2014, Bram Moolenaar wrote: > > > > Christian Brabandt wrote: > > > > > On Fr, 12 Dez 2014, Ingo Karkat wrote: > > > > > > > Hello Vim developers, > > > > > > > > patch 7.4.468 (BTW it doesn't appear in the list on > > > > ftp://ftp.vim.org/vol/2/vim/patches/7.4/README) addressed > > > > > > > > > Issue 26: CTRL-C does not interrupt after it was mapped and then > > > > > unmapped > > > > > > > > However, it apparently fails to consider the mapping _modes_ of > > > > CTRL-C, so when I have such insert mode mapping, then do :cmap <C-c> > > > > ... | cunmap <C-c>, the insert mode mapping (though it still is listed > > > > by :imap) becomes ineffective! (Same for other mode combinations.) I > > > > have various mappings that include the <C-c> key (have I mentioned I'm > > > > running out of keys?), and all of these get broken because one of my > > > > plugins temporarily sets up a :cmap <C-c>. > > > > > > > > > > > > I've used the following scriptlet to bisect the problem: > > > > > > > > nnoremap <C-c> :quit!<CR> > > > > nnoremap <C-x> :cquit!<CR> > > > > cnoremap <C-c> dummy > > > > cunmap <C-c> > > > > echomsg "Press <C-c><C-x> now" > > > > > > > > Interestingly, it requires actual typed keys, even :call > > > > feedkeys("\<C-c>", 't') doesn't work. > > > > > > > > I can reproduce this both on Windows/x64 and Linux/x64, up to the > > > > current Vim 7.4.542. > > > > > > > > Christian (as the author of the original patch), I hope you'll be able > > > > to get a fix for that! > > > > > > The fix is easy. Simply increment the mapped_ctrl_c flag when mapping > > > CTRL-C and decrement it when unmapping. Then Ctrl-C will work as > > > interrupt only, when ctrl-c is never mapped. > > > > Looks like this patch does not handle the sequence: > > > > :map <C-C> a > > :map <C-C> b > > :unmap <C-C> > > > > I would suggest getting the state flags for the mapping and using "OR" > > when mapping and "AND with inverted" when unmapping. Then when the > > result is zero we know CTRL-C is not mapped. > > > > As mentioned further on in the thread, ideally we would use the mask > > also for handling CTRL-C differently depending on the current mode. > > Not sure how easy or difficult that would be. > > Okay, how about that patch?
Thanks, I'll include it. But when resetting the flags it also has to check if it's a buffer-local mapping. -- hundred-and-one symptoms of being an internet addict: 84. Books in your bookcase bear the names Bongo, WinSock and Inside OLE /// 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/d/optout.
