1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-04 15:59:04 +02:00

Use VimCaret api in MotionActionHandler

This commit is contained in:
Alex Plate 2022-02-22 15:44:05 +03:00
parent 32df1597c4
commit 1484f4e370
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F

View File

@ -30,7 +30,6 @@ import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MotionType
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.group.MotionGroup
import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.inBlockSubMode
import com.maddyhome.idea.vim.helper.inVisualMode
@ -175,7 +174,7 @@ sealed class MotionActionHandler : EditorActionHandlerBase(false) {
resultOffset = EditorHelper.normalizeOffset(editor.ij, resultOffset, false)
}
preMove(editor, context, cmd)
MotionGroup.moveCaret(editor.ij, editor.ij.caretModel.primaryCaret, resultOffset)
editor.primaryCaret().moveToOffset(resultOffset)
postMove(editor, context, cmd)
}
is Motion.Error -> VimPlugin.indicateError()
@ -236,7 +235,7 @@ sealed class MotionActionHandler : EditorActionHandlerBase(false) {
resultMotion = EditorHelper.normalizeOffset(editor.ij, resultMotion, false)
}
preMove(editor, caret, context, cmd)
MotionGroup.moveCaret(editor.ij, caret.ij, resultMotion)
caret.moveToOffset(resultMotion)
val postMoveCaret = if (editor.ij.inBlockSubMode) editor.primaryCaret() else caret
postMove(editor, postMoveCaret, context, cmd)
}