1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-17 16:31:45 +02:00

Compare commits

..

2 Commits

Author SHA1 Message Date
dd8bfac3cf Set plugin version to chylex-26 2024-01-27 08:52:51 +01:00
fa434074d7 Apply scrolloff after executing native IDEA actions 2024-01-27 08:52:09 +01:00
2 changed files with 5 additions and 3 deletions

View File

@@ -11,7 +11,7 @@
ideaVersion=2023.3.2
downloadIdeaSources=true
instrumentPluginCode=true
version=chylex-25
version=chylex-26
javaVersion=17
remoteRobotVersion=0.11.21
antlrVersion=4.10.1

View File

@@ -34,7 +34,6 @@ import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.action.VimShortcutKeyAction
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.group.NotificationService
import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.isIdeaVimDisabledHere
import com.maddyhome.idea.vim.helper.vimStateMachine
import com.maddyhome.idea.vim.newapi.globalIjOptions
@@ -57,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) {
@@ -65,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
@@ -131,12 +132,13 @@ internal object IdeaSpecifics {
}
//endregion
if (EditorHelper.getVisibleArea(editor).let { it.width > 0 && it.height > 0 }) {
if (caretOffset != -1 && caretOffset != editor.caretModel.offset) {
injector.scroll.scrollCaretIntoView(editor.vim)
}
}
this.editor = null
this.caretOffset = -1
}
}