Skip to content

Commit

Permalink
Post-review improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
lippfi committed Jun 4, 2024
1 parent 55314a8 commit 2f692ec
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/maddyhome/idea/vim/ui/ex/ExActions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/maddyhome/idea/vim/ui/ex/ExEditorKit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void setEditor(@NotNull Editor editor, DataContext context) {
ExEntryPanel.getInstance().setEditor(editor);
}

public Editor getEditor() {
public @Nullable Editor getEditor() {
return ExEntryPanel.getInstance().getEditor();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2f692ec

Please sign in to comment.