ESC to exit search leaves editor in an unusable state
Brought to you by:
err
Using jVi 1.4.59.25 with NetBeans 7.1.2 on Mac OS X 10.7.4, exiting a search (i.e. "/...") by hitting ESC results in the search box closing but all subsequent keystrokes are swallowed. It appears that, although the search box has closed, keystrokes are still being added to the search since the status bar has a notification "Pattern not found: ..." followed by any characters entered in the search and after the search box has closed (ESC and enter are ignored, however, so it impossible to exit this state).
This also occurs with ":" command mode. In either case, deleting (via backspace) the command or search will not cause the problem. GUI functionality is not affected (only keyboard input) nor is keyboard functionality in other buffers/files.
This is the first I've heard of such a thing. May be a Mac issue. Have you successfully used jVi on a Mac with other releases/JVMs?
What's the setting for Tools>Options>jViConfig>Platform>UseModalFrame ? (Its under expert). You might try changing this setting.
I don't have a mac, can you reproduce it on WinXP?
I can't recall if I'd used it on OSX with a previous release, but it does appear to be a platform related issue. I just tested under XP with all else being essentially equal. Toggling UseModalFrame was my first thought too, but it makes no difference. One new observation is that the "real ESC" (CTRL-]) works as expected, so it's strictly related to the handling of the ESC key.
Perhaps the ESC key is hardcoded on the MAC. If it was hardcoded behavior associated with the combo box, then that could explain why UseModalFrame didn't change the behavior.
You can test jVi standalone (without NetBeans) by cloning http://jvi.hg.sourceforge.net:8000/hgroot/jvi/jvi with mercurial and doing "ant run" which brings up a JFrame with jVi running in it with some canned text for playing; I'd expect this to fail as well. This is a Java SE project in NetBeans. (clone nbvi if you want to run it under netbeans).
There was a MAC-Lion specific problem that was "fixed" by using terminal.app on the mac, see
http://www.karthikk.net/2011/08/how-to-enable-key-repeat-in-mac-os-x-lion/ http://www.belchak.com/2011/07/23/re-enabling-key-repeat-in-osx-lion/
maybe there's a clue in there. Maybe some way to modify ESC behavior. I just saw following after some searching
> Try looking at your button list...
>
> Go to Tools > Button List and open the Other menu,
> and see if Abort has esc assigned to it.
Maybe somewhere there's some mac config that can be adjusted...
Forgot to check... changing UseModalFrame requires an IDE restart.
I just double checked that I'd restarted between changing UseModelFrame, still no change. I dd notice, however, that I get an exception when I try to <ESC> from a search:
java.lang.NullPointerException
at com.raelity.jvi.swing.CommandLine$CommandLineEntry.fireEvent(CommandLine.java:835)
[catch] at com.raelity.jvi.swing.CommandLine$CommandLineEntry.finishUpEntry(CommandLine.java:821)
at com.raelity.jvi.swing.CommandLine$CommandLineEntry$1.actionPerformed(CommandLine.java:614)
at com.raelity.jvi.swing.CommandLine.fireCommandLineActionPerformed(CommandLine.java:547)
at com.raelity.jvi.swing.CommandLine$3.actionPerformed(CommandLine.java:491)
at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1661)
at javax.swing.JComponent.processKeyBinding(JComponent.java:2879)
at javax.swing.JComponent.processKeyBindings(JComponent.java:2926)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2842)
at java.awt.Component.processEvent(Component.java:6282)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1893)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:752)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1017)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:889)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:717)
at java.awt.Component.dispatchEventImpl(Component.java:4731)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
at java.awt.EventQueue.access$000(EventQueue.java:102)
at java.awt.EventQueue$3.run(EventQueue.java:662)
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:676)
at java.awt.EventQueue$4.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:162)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:155)
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:182)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:221)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:219)
at java.awt.Dialog.show(Dialog.java:1072)
at java.awt.Component.show(Component.java:1651)
at java.awt.Component.setVisible(Component.java:1603)
at java.awt.Window.setVisible(Window.java:1014)
at java.awt.Dialog.setVisible(Dialog.java:1003)
at com.raelity.jvi.swing.WindowCmdEntry.finishActivate(WindowCmdEntry.java:81)
at com.raelity.jvi.swing.CommandLine$CommandLineEntry.activate(CommandLine.java:679)
at com.raelity.jvi.manager.Scheduler.startCommandEntry(Scheduler.java:276)
at com.raelity.jvi.core.Search.inputSearchPattern(Search.java:159)
at com.raelity.jvi.core.Normal.nv_search(Normal.java:2815)
at com.raelity.jvi.core.Normal.normal_cmd(Normal.java:881)
at com.raelity.jvi.core.Normal.processInputChar(Normal.java:172)
at com.raelity.jvi.core.GetChar.pumpChar(GetChar.java:360)
at com.raelity.jvi.core.GetChar.pumpAllChars(GetChar.java:323)
at com.raelity.jvi.core.GetChar.startPump(GetChar.java:263)
at com.raelity.jvi.core.GetChar.gotc(GetChar.java:135)
at com.raelity.jvi.core.Hook.gotc(Hook.java:88)
at com.raelity.jvi.manager.Scheduler.keyStroke(Scheduler.java:219)
at com.raelity.jvi.swing.SwingFactory$EnqueCharAction.actionPerformed(SwingFactory.java:618)
at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1661)
at javax.swing.JComponent.processKeyBinding(JComponent.java:2879)
at javax.swing.JComponent.processKeyBindings(JComponent.java:2926)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2842)
at java.awt.Component.processEvent(Component.java:6282)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1893)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:752)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1017)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:889)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:717)
at java.awt.Component.dispatchEventImpl(Component.java:4731)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
at java.awt.EventQueue.access$000(EventQueue.java:102)
at java.awt.EventQueue$3.run(EventQueue.java:662)
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:676)
at java.awt.EventQueue$4.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:162)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Testing with jVi standalone (http://jvi.hg.sourceforge.net:8000/hgroot/jvi/jvi)
the <ESC> key works fine.
Fix in mercurial VCS.
Thanks to Tod for email assistance/testing