1995eaton / chromium-vim

Vim bindings for Google Chrome.
https://chrome.google.com/webstore/detail/cvim/ihlenndgcmojhcghmfjfneahoeklbjjh
MIT License
2.26k stars 325 forks source link

cVim occasionally stops working in a tab #281

Closed infokiller closed 9 years ago

infokiller commented 9 years ago

Reloading the tab fixes this (must be done with Ctrl+R since cVim is inresponsive). I don't have a deterministic way to reproduce it, but it happens to me more frequently in gmail and google calendar. I was able to reproduce this on incognito mode with cVim being the only active extension. I simply opened my gmail and then repeatedly opened the command bar and closed it (: followed by ESC). After 10-15 times it will usually reproduce.

Versions: Google Chrome 41.0.2272.118 (Official Build) Revision 94ac154e3d74de6a6a0ea008e7e7b69cd5960cb2-refs/branch-heads/2272@{#458} cVim 1.2.74

quicknir commented 9 years ago

It's been happening to me to quite a bit as well. It's kind of annoying, while overall I prefer the feature set of cvim, I may switch back to vimium if the stability doesn't sort itself out.

corngood commented 9 years ago

I can reproduce something like this by hitting ctrl-r and then immediately spamming / until after the page has reloaded. It works for me on most pages, including this one. Is that similar to what you guys see? I looked into it a bit and it seems to have something to do with showCommandFrame/hideCommandFrame, but I haven't come up with a fix yet.

1995eaton commented 9 years ago

I just pushed 49c0e76, which seems to fix this issue 99% of the time. It uses setTimeout, so it's not an elegant solution, but it will stop this from happening until I (or someone else) can provide a better fix. From my understanding, this issue started occurring after I moved the command bar to a separate frame. In the hideCommandFrame switch statement case label in messenger.js, I attempt to refocus the last HTML frame that was focused before the command bar frame appeared. In some cases, the last frame doesn't refocus (seems to happen more often when closing out of a frame using the backspace key rather than the escape key). If I happen to be talking about the same problem you guys are talking about, cVim doesn't "break" or stop working per say, but won't respond to key presses until an HTML frame (other than the hidden cVim command bar frame) is refocused. Clicking the main document should get cVim to respond to keystrokes again.

1995eaton commented 9 years ago

Also, let me know if 49c0e76 seems to be working for you all. Thanks!

corngood commented 9 years ago

I'm just testing it on my ancient athlon 64 media pc, and on 1.2.74 I can barely get the command bar to come up twice in a row, even on this page. With master (3e705b3121ed7364fdfe55a6251fac7434fb40ae) I haven't lost input once.

Nice one.