1
0
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:
Alex Plate 2019-07-26 19:57:09 +03:00
parent 95d7a7e860
commit 077cab656b
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
3 changed files with 16 additions and 13 deletions
src/com/maddyhome/idea/vim

View File

@ -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() {

View File

@ -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() {

View File

@ -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)