mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-03-07 03:32:51 +01:00
[EA-209305] Fix SO exception on enabling disabled plugin
This commit is contained in:
parent
95d7a7e860
commit
077cab656b
src/com/maddyhome/idea/vim
@ -68,12 +68,9 @@ public class EventFacade {
|
||||
|
||||
public void setupTypedActionHandler(@NotNull VimTypedActionHandler handler) {
|
||||
final TypedAction typedAction = getTypedAction();
|
||||
final TypedActionHandler rawHandler = typedAction.getRawHandler();
|
||||
if (!(rawHandler instanceof VimTypedActionHandler)) {
|
||||
// Actually this if should always be true, but just as protection
|
||||
myOriginalTypedActionHandler = rawHandler;
|
||||
typedAction.setupRawHandler(handler);
|
||||
}
|
||||
myOriginalTypedActionHandler = typedAction.getRawHandler();
|
||||
|
||||
typedAction.setupRawHandler(handler);
|
||||
}
|
||||
|
||||
public void restoreTypedActionHandler() {
|
||||
|
@ -342,7 +342,7 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
|
||||
ApplicationManager.getApplication().invokeLater(this::updateState);
|
||||
|
||||
VimListenerManager.GlobalListeners.enable();
|
||||
VimListenerManager.INSTANCE.turnOn();
|
||||
|
||||
// Register vim actions in command mode
|
||||
RegisterActions.registerActions();
|
||||
@ -447,12 +447,15 @@ public class VimPlugin implements BaseComponent, PersistentStateComponent<Elemen
|
||||
}
|
||||
|
||||
private void turnOnPlugin() {
|
||||
initializePlugin();
|
||||
KeyHandler.getInstance().fullReset(null);
|
||||
if (initialized) {
|
||||
KeyHandler.getInstance().fullReset(null);
|
||||
|
||||
getEditor().turnOn();
|
||||
getSearch().turnOn();
|
||||
VimListenerManager.INSTANCE.turnOn();
|
||||
getEditor().turnOn();
|
||||
getSearch().turnOn();
|
||||
VimListenerManager.INSTANCE.turnOn();
|
||||
} else {
|
||||
initializePlugin();
|
||||
}
|
||||
}
|
||||
|
||||
private void turnOffPlugin() {
|
||||
|
@ -131,7 +131,10 @@ object VimListenerManager {
|
||||
@JvmStatic
|
||||
fun enable() {
|
||||
val typedAction = EditorActionManager.getInstance().typedAction
|
||||
EventFacade.getInstance().setupTypedActionHandler(VimTypedActionHandler(typedAction.rawHandler))
|
||||
if (typedAction.rawHandler !is VimTypedActionHandler) {
|
||||
// Actually this if should always be true, but just as protection
|
||||
EventFacade.getInstance().setupTypedActionHandler(VimTypedActionHandler(typedAction.rawHandler))
|
||||
}
|
||||
|
||||
OptionsManager.number.addOptionChangeListener(EditorGroup.NumberChangeListener.INSTANCE)
|
||||
OptionsManager.relativenumber.addOptionChangeListener(EditorGroup.NumberChangeListener.INSTANCE)
|
||||
|
Loading…
Reference in New Issue
Block a user