lalitmetkar / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Ctrl-C doesn't perform interrupt after map/unmap #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. $ echo "for i in range(1,4) | %s/r/x/gc | endfor" > temp.vim
2. $ vim -N -u NONE -U NONE temp.vim
3. :so % 
4. Note that issuing a Ctrl-C interrupts the loop
5. :map <c-c> abc
6. :unmap <c-c>
7. :so %
8. Issuing Ctrl-C do NOT interrupted the loop anymore.

What is the expected output? What do you see instead?
It was expected that the behavior of Ctrl-C before mapping and after mapping 
and unmapping would be the same, breaking the loop.

What version of the product are you using? On what operating system?
Vim 7.3 under Windows XP.

Please provide any additional information below.
As an attempt to workaround the problem it was tried to ':unmap <c-c>' and then 
':map <c-c> <c-break>', using Ctrl-Break as described in ':help :map_CTRL-C', 
but it didn't worked, in despite that directly typing Ctrl-Break breaks the 
loop.

Reference information: 
http://stackoverflow.com/questions/7485740/capturing-break-interrupt-command

Original issue reported on code.google.com by marcmo...@gmail.com on 10 Oct 2011 at 12:13

Attachments:

GoogleCodeExporter commented 9 years ago
This happens, because mapped_ctrl_c is never reset.

This patch fixes it:
diff --git a/src/getchar.c b/src/getchar.c
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -3707,6 +3707,9 @@ do_map(maptype, arg, mode, abbrev)
     {
        if (!did_it)
            retval = 2;                     /* no match */
+       else if (*keys == Ctrl_C)
+       /* If CTRL-C has been unmapped, reuse it for Interrupting */
+           mapped_ctrl_c = FALSE;
        goto theend;
     }

Original comment by chrisbr...@googlemail.com on 30 Sep 2014 at 8:25

GoogleCodeExporter commented 9 years ago
Fixed by 7.4.468

Original comment by chrisbr...@googlemail.com on 9 Oct 2014 at 1:04

GoogleCodeExporter commented 9 years ago
Thank you very much, Christian!

Original comment by marcmo...@gmail.com on 9 Oct 2014 at 1:17