Red Hat Bugzilla – Bug 462033
vnoremap <C-C> interacts badly with gnome show-pointer-position-when-CTRL-pressed
Last modified: 2011-06-14 02:13:12 EDT
mswin.vim remaps CTRL-C and CTRL-Insert as follows:
vnoremap <C-C> "+y
vnoremap <C-Insert> "+y
Also remapping are other CTRL-key combinations such as:
map <C-V> "+gP
noremap <C-A> gggH<C-O>G
There is a Gnome option "Show position of pointer when the Control key is pressed" available at:
System (Gnome panel menu) -> Preferences -> Hardware -> Mouse
If this Gnome option of disabled, then CTRL-C, CTRL-INSERT, CTRL-V, CTRL-A all work fine.
If this Gnome option is enabled, then CTRL-C does not work (vim leaves visual mode, but the previously selected data is not copied to the clipboard). However, all the other keys mentioned above work just fine.
I ran the xev application and looked at the events received for CTRL-A and CTRL-C with the Gnome option on. I couldn't see any difference (except the keycode obviously)
Hence, since I believe vim is getting the same events for both keys, it's a vim bug the CTRL-C doesn't work, not a Gnome bug.
Note that when this Gnome option is enabled, vim/xev do receive a bunch of extra focus/grab events relative to when the Gnome option is disabled. Perhaps this is what's causing the issue?
FYI, with the Gnome option turned on:
* pressing CTRL-SHIFT-C makes vim to the copy OK...
* pressing some key between the CTRL and C makes it work, e.g. press and hold CTRL, press and release SHIFT (or L), press C, release everything
The vim IRC channel was helpful. Here's part of an IRC log for posterity:
[22:35] <\amethyst> swarren: I see the same behaviour: it looks like the ctrl-c still gets through to vim, but doesn't get mapped
[22:36] <\amethyst> swarren: it does seem to work if you press ctrl-shift-c
[22:37] <swarren> yup, C-S-C works for me too
[22:39] <\amethyst> swarren: also if you press another key between control and c
[22:39] <\amethyst> swarren: like <hold ctrl><press and release shift><press c><release ctrl>
[22:39] <swarren> Or even CTRL L C !
[22:39] <\amethyst> yeah
[22:40] <\amethyst> when I press ctrl and the Gnome thing activates, the cursor changes to the inactive cursor
[22:40] <\amethyst> but the window still appears to have the focus
[22:40] <\amethyst> so maybe vim is being confused by having keyboard focus stolen temporarily
[22:41] <swarren> Yeah, I think that's related to the grab/ungrab events I see in xev
[22:41] <swarren> and there was a pair of focus out/in events too I think
[22:42] <\amethyst> vim doesn't get a keypress event for the ctrl
[22:42] <\amethyst> it gets one for the C, with the correct state bits set
[22:44] <\amethyst> maybe that is confusing it, but... when you press shift in the middle you get keypress/release events for the shift but still no events for the control
[22:45] <swarren> hmm. That sequence of events make sense, although vim's interpretation of them doesn't. Especially since a direct press of e.g. CTRL-A/CTRL-V works without anything intermediate.
[22:47] <\amethyst> swarren: ctrl-c is handled specially in the input code, so that might have something to do with it
[22:48] <swarren> Yeah, that'd make sense
[22:50] <\amethyst> swarren: there's a variable called ctrl_c_interrupts; maybe it's not being set to FALSE when it should
[22:51] <\amethyst> swarren: (it's supposed to be set to false whenever the GUI is waiting and ctrl-c is mapped)
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '9'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 9's end of life.
Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 9 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora please change the 'version' of this
bug to the applicable version. If you are unable to change the version,
please add a comment here and someone will do it for you.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
The process we are following is described here:
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version.
Thank you for reporting this bug and we are sorry it could not be fixed.
For my reference, near the end of gui_gtk_x11.c:key_press_event(), changing from:
if (len == 1 && ((string == Ctrl_C && ctrl_c_interrupts)
|| (string == intr_char && intr_char != Ctrl_C)))
if (len == 1 && ((string == Ctrl_C && ctrl_c_interrupts && !mapped_ctrl_c)
|| (string == intr_char && intr_char != Ctrl_C)))
appears to solve this, and CTRL-C still works when entering a command after pressing ":" in normal mode.
(The difference between the Gnome option and not is that pressing/release the CTRL key generates focus in/out events via gui.c:gui_focus_change(). I'm not totally sure why this affects the ctrl_C_interrupts variable though.)