1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-02-22 20:46:02 +01:00

Post-review improvements

This commit is contained in:
Filipp Vakhitov 2024-06-04 12:55:47 +03:00 committed by Alex Pláte
parent 26c87535d6
commit 2c0ff587e3
5 changed files with 8 additions and 18 deletions
src/main/java/com/maddyhome/idea/vim/ui/ex
vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api

View File

@ -76,7 +76,7 @@ internal class CompleteEntryAction : TextAction(ExEditorKit.CompleteEntry) {
// * The key handler routines get the chance to clean up and reset state
val entry = ExEntryPanel.getInstance().entry
val keyHandler = KeyHandler.getInstance()
keyHandler.handleKey(entry.editor.vim, stroke, entry.context.vim, keyHandler.keyHandlerState)
keyHandler.handleKey(entry.editor!!.vim, stroke, entry.context.vim, keyHandler.keyHandlerState)
}
companion object {
@ -198,7 +198,7 @@ internal class DeletePreviousWordAction : TextAction(DefaultEditorKit.deletePrev
target.saveLastEntry()
val doc = target.document
val caret = target.caret
val project = target.editor.project
val project = target.editor!!.project
// Create a VimEditor instance on the Swing text field which we can pass to the search helpers. We need an editor
// rather than just working on a buffer because the search helpers need local options (specifically the local to
@ -208,7 +208,7 @@ internal class DeletePreviousWordAction : TextAction(DefaultEditorKit.deletePrev
// This will mean we always have an editor that has been initialised for options, etc. But also means that we can
// share the command line entry actions between IdeaVim implementations
val editor = TextComponentEditorImpl(project, target).vim
injector.optionGroup.initialiseLocalOptions(editor, target.editor.vim, LocalOptionInitialisationScenario.CMD_LINE)
injector.optionGroup.initialiseLocalOptions(editor, target.editor!!.vim, LocalOptionInitialisationScenario.CMD_LINE)
val offset = injector.searchHelper.findNextWord(editor, caret.dot, -1, bigWord = false, spaceWords = false)
if (logger.isDebugEnabled) logger.debug("offset=$offset")

View File

@ -122,7 +122,7 @@ internal object ExEditorKit : DefaultEditorKit() {
val entry = ExEntryPanel.getInstance().entry
val editor = entry.editor
val keyHandler = KeyHandler.getInstance()
keyHandler.handleKey(editor.vim, key, entry.context.vim, keyHandler.keyHandlerState)
keyHandler.handleKey(editor!!.vim, key, entry.context.vim, keyHandler.keyHandlerState)
} else {
val event = ActionEvent(e.source, e.id, c.toString(), e.getWhen(), e.modifiers)
super.actionPerformed(event)

View File

@ -42,7 +42,7 @@ internal class ExShortcutKeyAction(private val exEntryPanel: ExEntryPanel) : Dum
// e.dataContext will refer to the ex-entry editor and commands will be executed on it,
// thus it should not be used. For example, `:action EditorSelectWord` will not work with this context
val mainEditorContext = exEntryPanel.entry.context.vim
keyHandler.handleKey(editor.vim, keyStroke, mainEditorContext, keyHandler.keyHandlerState)
keyHandler.handleKey(editor!!.vim, keyStroke, mainEditorContext, keyHandler.keyHandlerState)
}
}

View File

@ -210,7 +210,7 @@ public class ExTextField extends JTextField {
ExEntryPanel.getInstance().setEditor(editor);
}
public Editor getEditor() {
public @Nullable Editor getEditor() {
return ExEntryPanel.getInstance().getEditor();
}

View File

@ -53,22 +53,12 @@ public abstract class VimSearchGroupBase : VimSearchGroup {
/**
* Last used search direction.
*/
@JvmStatic
protected var lastDirection: Direction = Direction.FORWARDS
@JvmStatic
get
@JvmStatic
set
public var lastDirection: Direction = Direction.FORWARDS
/**
* The type of the last used pattern.
*/
@JvmStatic
protected var lastPatternType: PatternType? = null
@JvmStatic
get
@JvmStatic
set
public var lastPatternType: PatternType? = null
/**
* Last used substitute string.