1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-25 00:34:09 +02:00

Remove ExEntryPanel and move its method to VimCommandLine

This commit is contained in:
Filipp Vakhitov 2024-05-31 22:27:41 +03:00 committed by Alex Pláte
parent c83ecc46ed
commit ae4b88a06b
8 changed files with 16 additions and 42 deletions
src/main/java/com/maddyhome/idea/vim
vim-engine/src/main/kotlin/com/maddyhome/idea/vim

View File

@ -1,19 +0,0 @@
/*
* Copyright 2003-2023 The IdeaVim authors
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT.
*/
package com.maddyhome.idea.vim.newapi
import com.intellij.openapi.components.Service
import com.maddyhome.idea.vim.api.ExEntryPanel
@Service
internal class IjExEntryPanel : ExEntryPanel {
override fun clearCurrentAction() {
com.maddyhome.idea.vim.ui.ex.ExEntryPanel.getInstance().entry.clearCurrentAction()
}
}

View File

@ -14,7 +14,6 @@ import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.textarea.TextComponentEditorImpl
import com.maddyhome.idea.vim.api.EngineEditorHelper
import com.maddyhome.idea.vim.api.ExEntryPanel
import com.maddyhome.idea.vim.api.ExecutionContextManager
import com.maddyhome.idea.vim.api.LocalOptionInitialisationScenario
import com.maddyhome.idea.vim.api.NativeActionManager
@ -107,8 +106,6 @@ internal class IjVimInjector : VimInjectorBase() {
override val actionExecutor: VimActionExecutor
get() = service<IjActionExecutor>()
override val exEntryPanel: ExEntryPanel
get() = service<IjExEntryPanel>()
override val exOutputPanel: VimExOutputPanelService
get() = object : VimExOutputPanelService {
override fun getPanel(editor: VimEditor): VimExOutputPanel {

View File

@ -492,6 +492,16 @@ public class ExEntryPanel extends JPanel implements VimCommandLine {
entry.updateText(string);
}
@Override
public void clearPromptCharacter() {
entry.clearCurrentActionPromptCharacter();
}
@Override
public void clearCurrentAction() {
entry.clearCurrentAction();
}
public static class LafListener implements LafManagerListener {
@Override
public void lookAndFeelChanged(@NotNull LafManager source) {

View File

@ -333,7 +333,7 @@ public class ExTextField extends JTextField {
setCaretPosition(currentActionPromptCharacterOffset);
}
private void clearCurrentActionPromptCharacter() {
void clearCurrentActionPromptCharacter() {
final int offset = getCaretPosition();
final String text = removePromptCharacter();
updateText(text);

View File

@ -1,14 +0,0 @@
/*
* Copyright 2003-2023 The IdeaVim authors
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT.
*/
package com.maddyhome.idea.vim.api
public interface ExEntryPanel {
@Deprecated("Remove it after completely removing Swing TextActions")
public fun clearCurrentAction()
}

View File

@ -33,4 +33,7 @@ public interface VimCommandLine {
public fun deactivate(refocusOwningEditor: Boolean, resetCaret: Boolean)
public fun setPromptCharacter(char: Char)
public fun clearPromptCharacter()
public fun clearCurrentAction()
}

View File

@ -108,9 +108,6 @@ public interface VimInjector {
// Can't be fully moved to vim-engine.
public val actionExecutor: VimActionExecutor
// Can't be fully moved to vim-engine.
public val exEntryPanel: ExEntryPanel
// Can't be fully moved to vim-engine.
public val exOutputPanel: VimExOutputPanelService

View File

@ -72,7 +72,7 @@ public class DigraphConsumer : KeyConsumer {
return false
} else {
keyProcessResultBuilder.addExecutionStep { _, _, _ ->
injector.exEntryPanel.clearCurrentAction()
commandLine.clearCurrentAction()
}
}
}
@ -96,7 +96,7 @@ public class DigraphConsumer : KeyConsumer {
return false
} else {
keyProcessResultBuilder.addExecutionStep { _, _, _ ->
injector.exEntryPanel.clearCurrentAction()
commandLine.clearCurrentAction()
}
}
}