Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this issue Aug 18, 2015 · 3 comments
Closed

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

GoogleCodeExporter opened this issue Aug 18, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

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

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

Fixed by 7.4.468

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

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Thank you very much, Christian!

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

rbtnn pushed a commit to rbtnn/vim that referenced this issue Jan 9, 2019
Soluton: Use NOT_VALID in redraw_all_later() (Fixed: vim#26 by markonm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant