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

GVim operator pending with remapped keys getting cancelled #5302

Open
sosmo opened this issue Dec 1, 2019 · 3 comments
Open

GVim operator pending with remapped keys getting cancelled #5302

sosmo opened this issue Dec 1, 2019 · 3 comments

Comments

@sosmo
Copy link

sosmo commented Dec 1, 2019

Related to #5300 (comment) . Thanks for the quick fix! I tested the new version, and there still seems to be an issue left when keys are remapped.

Steps to reproduce

  1. Run gvim --clean
:set timeoutlen=9999<cr>
:onoremap qq i[<cr>
i[hello]<esc>h
dq
*alt-tab*
q

If you do the alt-tab, the final q press does nothing. If you don't do the alt-tab, doing "dqq" deletes the text between the brackets as it should. The alt-tab somehow messes gVim up - it changes Vim's state instead of getting totally ignored. The same happens if you use xbindkeys to remap keys - if you have a mapping ctrl+x -> q and try to do d<ctrl-x><ctrl-x>, typing ctrl+x cancels operator pending, and when the virtual q press is received, Vim prompts for a macro instead of deleting the text inside the brackets.

I tried looking at the source code and I assume the problem is that you'd need to bail earlier when a control keycode is received, but the character is read inside the normal_cmd with safe_vgetc and that might be too late if the state change happens in the main_loop. Or maybe some control character isn't being recognized right?

I tried compiling an earlier version of Vim that I knew had worked and it had the same problem now - seems one of the dependencies has changed and caused the new issue. It seems to behave the same way on Ubuntu's pre-packaged versions with other GUIs too - vim-athena and vim-gtk3.

Sorry for the trouble!

Environment

  • OS: Kubuntu 19.10
  • Vim version:
VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec  2 2019 00:36:47)
Included patches: 1-2377
Huge version with GTK2 GUI.  Features included (+) or not (-):
...
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16   -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux -ldl           
@brammool
Copy link
Contributor

brammool commented Dec 2, 2019 via email

@sosmo
Copy link
Author

sosmo commented Dec 3, 2019

Thank you! This is indeed not a problem most people are likely going to have, and it's only caused me problems with keyboard remaps (have ctrl+{7,8,9,0} bound to paren characters).

I'll try looking some more into the code too, see if I can help fix it. Maybe the typeahead buffer can be set to ignore irrelevant control characters in GUI

@brammool
Copy link
Contributor

brammool commented Dec 3, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants