mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-11-05 04:22:18 +01:00
Compare commits
2 Commits
customized
...
customized
| Author | SHA1 | Date | |
|---|---|---|---|
|
dd8bfac3cf
|
|||
|
fa434074d7
|
@@ -11,7 +11,7 @@
|
||||
ideaVersion=2023.3.2
|
||||
downloadIdeaSources=true
|
||||
instrumentPluginCode=true
|
||||
version=chylex-1
|
||||
version=chylex-26
|
||||
javaVersion=17
|
||||
remoteRobotVersion=0.11.21
|
||||
antlrVersion=4.10.1
|
||||
|
||||
@@ -56,6 +56,7 @@ internal object IdeaSpecifics {
|
||||
private val surrounderAction =
|
||||
"com.intellij.codeInsight.generation.surroundWith.SurroundWithHandler\$InvokeSurrounderAction"
|
||||
private var editor: Editor? = null
|
||||
private var caretOffset = -1
|
||||
private var completionPrevDocumentLength: Int? = null
|
||||
private var completionPrevDocumentOffset: Int? = null
|
||||
override fun beforeActionPerformed(action: AnAction, event: AnActionEvent) {
|
||||
@@ -64,6 +65,7 @@ internal object IdeaSpecifics {
|
||||
val hostEditor = event.dataContext.getData(CommonDataKeys.HOST_EDITOR)
|
||||
if (hostEditor != null) {
|
||||
editor = hostEditor
|
||||
caretOffset = hostEditor.caretModel.offset
|
||||
}
|
||||
|
||||
val isVimAction = (action as? AnActionWrapper)?.delegate is VimShortcutKeyAction
|
||||
@@ -95,7 +97,8 @@ internal object IdeaSpecifics {
|
||||
if (VimPlugin.isNotEnabled()) return
|
||||
|
||||
val editor = editor
|
||||
if (editor != null && action is ChooseItemAction && editor.vimStateMachine?.isRecording == true) {
|
||||
if (editor != null) {
|
||||
if (action is ChooseItemAction && editor.vimStateMachine?.isRecording == true) {
|
||||
val prevDocumentLength = completionPrevDocumentLength
|
||||
val prevDocumentOffset = completionPrevDocumentOffset
|
||||
|
||||
@@ -122,16 +125,20 @@ internal object IdeaSpecifics {
|
||||
)
|
||||
}
|
||||
) {
|
||||
editor?.let {
|
||||
val commandState = it.vim.vimStateMachine
|
||||
val commandState = editor.vim.vimStateMachine
|
||||
commandState.mode = Mode.NORMAL()
|
||||
VimPlugin.getChange().insertBeforeCursor(it.vim, event.dataContext.vim)
|
||||
KeyHandler.getInstance().reset(it.vim)
|
||||
}
|
||||
VimPlugin.getChange().insertBeforeCursor(editor.vim, event.dataContext.vim)
|
||||
KeyHandler.getInstance().reset(editor.vim)
|
||||
}
|
||||
//endregion
|
||||
|
||||
if (caretOffset != -1 && caretOffset != editor.caretModel.offset) {
|
||||
injector.scroll.scrollCaretIntoView(editor.vim)
|
||||
}
|
||||
}
|
||||
|
||||
this.editor = null
|
||||
this.caretOffset = -1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user