mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-02-25 02:46:01 +01:00
Move VimEditor to vim-engine
This commit is contained in:
parent
d4a1ffa9a9
commit
042e3388b0
src
main/java/com/maddyhome/idea/vim
action/motion
leftright
MotionColumnAction.ktMotionEndAction.ktMotionFirstColumnAction.ktMotionFirstNonSpaceAction.ktMotionFirstScreenColumnAction.ktMotionFirstScreenNonSpaceAction.ktMotionLastColumnAction.ktMotionLastMatchCharAction.ktMotionLastMatchCharReverseAction.ktMotionLastNonSpaceAction.ktMotionLastScreenColumnAction.ktMotionLeftAction.ktMotionLeftWrapAction.ktMotionMiddleColumnAction.ktMotionRightAction.ktMotionRightWrapAction.ktTillCharacterMotion.kt
mark
MotionGotoFileMarkAction.ktMotionGotoFileMarkLineAction.ktMotionGotoMarkAction.ktMotionGotoMarkLineAction.ktMotionJumpNextAction.ktMotionJumpPreviousAction.kt
screen
search
SearchAgainNextAction.ktSearchAgainPreviousAction.ktSearchEntryFwdAction.ktSearchEntryRevAction.ktSearchWholeWordBackwardAction.ktSearchWholeWordForwardAction.ktSearchWordBackwardAction.ktSearchWordForwardAction.kt
select/motion
text
MotionBigWordEndLeftAction.ktMotionBigWordEndRightAction.ktMotionBigWordLeftAction.ktMotionBigWordRightAction.ktMotionCamelEndLeftAction.ktMotionCamelEndRightAction.ktMotionCamelLeftAction.ktMotionCamelRightAction.ktMotionMethodNextEndAction.ktMotionMethodNextStartAction.ktMotionMethodPreviousEndAction.ktMotionMethodPreviousStartAction.ktMotionNthCharacterAction.ktMotionParagraphNextAction.ktMotionParagraphPreviousAction.ktMotionSectionBackwardEndAction.ktMotionSectionBackwardStartAction.ktMotionSectionForwardEndAction.ktMotionSectionForwardStartAction.ktMotionSentenceNextEndAction.ktMotionSentenceNextStartAction.ktMotionSentencePreviousEndAction.ktMotionSentencePreviousStartAction.ktMotionUnmatchedAction.ktMotionWordEndLeftAction.ktMotionWordEndRightAction.ktMotionWordLeftAction.ktMotionWordRightAction.kt
updown
command
extension/matchit
group
handler
ChangeEditorActionHandler.ktEditorActionHandlerBase.ktMotionActionHandler.ktSpecialKeyHandlers.ktTextObjectActionHandler.ktVimActionHandler.ktVisualOperatorActionHandler.kt
helper
key
newapi
test/java/org/jetbrains/plugins/ideavim/common/editor
vim-engine/src/main/java/com/maddyhome/idea/vim/api
@ -26,26 +26,26 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.helper.vimLastColumn
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionColumnAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToColumn(editor.ij, caret.ij, operatorArguments.count1 - 1, false)
|
||||
}
|
||||
|
||||
override fun postMove(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
) {
|
||||
caret.ij.vimLastColumn = cmd.count - 1
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import com.maddyhome.idea.vim.helper.inVisualMode
|
||||
import com.maddyhome.idea.vim.helper.vimLastColumn
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
||||
|
@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -37,11 +37,11 @@ class MotionFirstColumnAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.EXCLUSIVE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToLineStart(editor.ij, caret.ij).toMotion()
|
||||
}
|
||||
@ -53,11 +53,11 @@ class MotionFirstColumnInsertModeAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_STROKE)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToLineStart(editor.ij, caret.ij).toMotion()
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
|
@ -24,17 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionFirstScreenColumnAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToLineScreenStart(editor.ij, caret.ij)
|
||||
}
|
||||
|
@ -25,17 +25,17 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionFirstScreenNonSpaceAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToLineScreenStartSkipLeading(editor.ij, caret.ij).toMotion()
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import com.maddyhome.idea.vim.helper.inVisualMode
|
||||
import com.maddyhome.idea.vim.helper.isEndAllowed
|
||||
import com.maddyhome.idea.vim.helper.vimLastColumn
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
||||
@ -49,11 +49,11 @@ open class MotionLastColumnAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.INCLUSIVE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val allow = if (editor.ij.inVisualMode) {
|
||||
val opt = (VimPlugin.getOptionService().getOptionValue(OptionService.Scope.LOCAL(editor),
|
||||
|
@ -24,17 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionLastMatchCharAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val repeatLastMatchChar = VimPlugin.getMotion().repeatLastMatchChar(editor.ij, caret.ij, operatorArguments.count1)
|
||||
return if (repeatLastMatchChar < 0) Motion.Error else Motion.AbsoluteOffset(repeatLastMatchChar)
|
||||
|
@ -24,17 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionLastMatchCharReverseAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val repeatLastMatchChar = VimPlugin.getMotion().repeatLastMatchChar(editor.ij, caret.ij, -operatorArguments.count1)
|
||||
return if (repeatLastMatchChar < 0) Motion.Error else Motion.AbsoluteOffset(repeatLastMatchChar)
|
||||
|
@ -25,17 +25,17 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionLastNonSpaceAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToLineEndSkipLeadingOffset(editor.ij, caret.ij, operatorArguments.count1 - 1)
|
||||
.toMotion()
|
||||
|
@ -29,7 +29,7 @@ import com.maddyhome.idea.vim.helper.inInsertMode
|
||||
import com.maddyhome.idea.vim.helper.inVisualMode
|
||||
import com.maddyhome.idea.vim.helper.vimLastColumn
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
||||
@ -38,11 +38,11 @@ import com.maddyhome.idea.vim.vimscript.services.OptionService
|
||||
|
||||
class MotionLastScreenColumnAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
var allow = false
|
||||
if (editor.ij.inInsertMode) {
|
||||
@ -58,10 +58,10 @@ class MotionLastScreenColumnAction : MotionActionHandler.ForEachCaret() {
|
||||
}
|
||||
|
||||
override fun postMove(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
) {
|
||||
caret.ij.vimLastColumn = MotionGroup.LAST_COLUMN
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.awt.event.KeyEvent
|
||||
@ -36,11 +36,11 @@ class MotionLeftAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.EXCLUSIVE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val offsetOfHorizontalMotion =
|
||||
VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor.ij, caret.ij, -operatorArguments.count1, false)
|
||||
@ -57,11 +57,11 @@ class MotionLeftInsertModeAction : MotionActionHandler.ForEachCaret(), Complicat
|
||||
)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val offsetOfHorizontalMotion =
|
||||
VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor.ij, caret.ij, -operatorArguments.count1, false)
|
||||
|
@ -24,17 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionLeftWrapAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val moveCaretHorizontalWrap =
|
||||
VimPlugin.getMotion().moveCaretHorizontalWrap(editor.ij, caret.ij, -operatorArguments.count1)
|
||||
|
@ -24,17 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionMiddleColumnAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToMiddleColumn(editor.ij, caret.ij)
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.awt.event.KeyEvent
|
||||
@ -37,11 +37,11 @@ class MotionRightAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.EXCLUSIVE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor.ij, caret.ij, operatorArguments.count1, true)
|
||||
.toMotionOrError()
|
||||
@ -57,11 +57,11 @@ class MotionRightInsertAction : MotionActionHandler.ForEachCaret(), ComplicatedK
|
||||
)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().getOffsetOfHorizontalMotion(editor.ij, caret.ij, operatorArguments.count1, true)
|
||||
.toMotionOrError()
|
||||
|
@ -25,17 +25,17 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionRightWrapAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretHorizontalWrap(editor.ij, caret.ij, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.Direction
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -60,11 +60,11 @@ sealed class TillCharacterMotion(
|
||||
if (direction == Direction.BACKWARDS) MotionType.EXCLUSIVE else MotionType.INCLUSIVE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
if (argument == null) return Motion.Error
|
||||
val res = if (finishBeforeCharacter) {
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -40,11 +40,11 @@ class MotionGotoFileMarkAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
if (argument == null) return Motion.Error
|
||||
|
||||
@ -59,11 +59,11 @@ class MotionGotoFileMarkNoSaveJumpAction : MotionActionHandler.ForEachCaret() {
|
||||
override val argumentType: Argument.Type = Argument.Type.CHARACTER
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
if (argument == null) return Motion.Error
|
||||
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -40,11 +40,11 @@ class MotionGotoMarkAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
if (argument == null) return Motion.Error
|
||||
|
||||
@ -59,11 +59,11 @@ class MotionGotoMarkNoSaveJumpAction : MotionActionHandler.ForEachCaret() {
|
||||
override val argumentType: Argument.Type = Argument.Type.CHARACTER
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
if (argument == null) return Motion.Error
|
||||
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -40,11 +40,11 @@ class MotionGotoMarkLineAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
if (argument == null) return Motion.Error
|
||||
|
||||
@ -59,11 +59,11 @@ class MotionGotoMarkLineNoSaveJumpAction : MotionActionHandler.ForEachCaret() {
|
||||
override val argumentType: Argument.Type = Argument.Type.CHARACTER
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
if (argument == null) return Motion.Error
|
||||
|
||||
|
@ -25,17 +25,17 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionJumpNextAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToJump(editor.ij, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -25,17 +25,17 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionJumpPreviousAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToJump(editor.ij, -operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.helper.vimLine
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -50,11 +50,11 @@ abstract class MotionFirstScreenLineActionBase(private val operatorPending: Bool
|
||||
override val motionType: MotionType = MotionType.LINE_WISE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
|
||||
// Only apply scrolloff for NX motions. For op pending, use the actual first line and apply scrolloff after.
|
||||
|
@ -29,7 +29,7 @@ import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.helper.vimLine
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -43,11 +43,11 @@ class MotionMiddleScreenLineAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.LINE_WISE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToMiddleScreenLine(editor.ij, caret.ij).toMotion()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class SearchAgainNextAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getSearch().searchNext(editor.ij, caret.ij, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class SearchAgainPreviousAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getSearch().searchPrevious(editor.ij, caret.ij, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.Direction
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -39,11 +39,11 @@ class SearchEntryFwdAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
if (argument == null) return Motion.Error
|
||||
return VimPlugin.getSearch()
|
||||
|
@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.Direction
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -39,11 +39,11 @@ class SearchEntryRevAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
if (argument == null) return Motion.Error
|
||||
return VimPlugin.getSearch()
|
||||
|
@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.handler.toMotionOrNoMotion
|
||||
import com.maddyhome.idea.vim.helper.Direction
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -37,11 +37,11 @@ class SearchWholeWordBackwardAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getSearch().searchWord(editor.ij, caret.ij, operatorArguments.count1, true, Direction.BACKWARDS)
|
||||
.toMotionOrNoMotion()
|
||||
|
@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.handler.toMotionOrNoMotion
|
||||
import com.maddyhome.idea.vim.helper.Direction
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -37,11 +37,11 @@ class SearchWholeWordForwardAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getSearch().searchWord(editor.ij, caret.ij, operatorArguments.count1, true, Direction.FORWARDS)
|
||||
.toMotionOrNoMotion()
|
||||
|
@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.Direction
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -37,11 +37,11 @@ class SearchWordBackwardAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getSearch().searchWord(editor.ij, caret.ij, operatorArguments.count1, false, Direction.BACKWARDS)
|
||||
.toMotionOrError()
|
||||
|
@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.Direction
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -37,11 +37,11 @@ class SearchWordForwardAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getSearch().searchWord(editor.ij, caret.ij, operatorArguments.count1, false, Direction.FORWARDS)
|
||||
.toMotionOrError()
|
||||
|
@ -30,7 +30,7 @@ import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.exitSelectMode
|
||||
import com.maddyhome.idea.vim.helper.isTemplateActive
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
||||
|
@ -30,7 +30,7 @@ import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.exitSelectMode
|
||||
import com.maddyhome.idea.vim.helper.isTemplateActive
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
||||
|
@ -24,17 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionBigWordEndLeftAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextWordEnd(editor.ij, caret.ij, -operatorArguments.count1, true)
|
||||
}
|
||||
|
@ -24,17 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionBigWordEndRightAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextWordEnd(editor.ij, caret.ij, operatorArguments.count1, true)
|
||||
}
|
||||
|
@ -24,17 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionBigWordLeftAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().findOffsetOfNextWord(editor.ij, caret.offset.point, -operatorArguments.count1, true)
|
||||
}
|
||||
|
@ -24,17 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionBigWordRightAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().findOffsetOfNextWord(editor.ij, caret.offset.point, operatorArguments.count1, true)
|
||||
}
|
||||
|
@ -25,17 +25,17 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionCamelEndLeftAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextCamelEnd(editor.ij, caret.ij, -operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -25,17 +25,17 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionCamelEndRightAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextCamelEnd(editor.ij, caret.ij, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -25,17 +25,17 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionCamelLeftAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextCamel(editor.ij, caret.ij, -operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -25,17 +25,17 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionCamelRightAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextCamel(editor.ij, caret.ij, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -35,11 +35,11 @@ class MotionMethodNextEndAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val moveCaretToMethodEnd = VimPlugin.getMotion().moveCaretToMethodEnd(editor.ij, caret.ij, operatorArguments.count1)
|
||||
return if (moveCaretToMethodEnd < 0) Motion.Error else Motion.AbsoluteOffset(moveCaretToMethodEnd)
|
||||
|
@ -26,7 +26,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -35,11 +35,11 @@ class MotionMethodNextStartAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val moveCaretToMethodStart = VimPlugin.getMotion().moveCaretToMethodStart(editor.ij, caret.ij, operatorArguments.count1)
|
||||
return if (moveCaretToMethodStart < 0) Motion.Error else Motion.AbsoluteOffset(moveCaretToMethodStart)
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionMethodPreviousEndAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToMethodEnd(editor.ij, caret.ij, -operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionMethodPreviousStartAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToMethodStart(editor.ij, caret.ij, -operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionNthCharacterAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNthCharacter(editor.ij, operatorArguments.count1 - 1).toMotion()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionParagraphNextAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextParagraph(editor.ij, caret.ij, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionParagraphPreviousAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextParagraph(editor.ij, caret.ij, -operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionSectionBackwardEndAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToSection(editor.ij, caret.ij, '}', -1, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionSectionBackwardStartAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToSection(editor.ij, caret.ij, '{', -1, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionSectionForwardEndAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToSection(editor.ij, caret.ij, '}', 1, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionSectionForwardStartAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToSection(editor.ij, caret.ij, '{', 1, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionSentenceNextEndAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextSentenceEnd(editor.ij, caret.ij, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionSentenceNextStartAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextSentenceStart(editor.ij, caret.ij, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionSentencePreviousEndAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextSentenceEnd(editor.ij, caret.ij, -operatorArguments.count1)
|
||||
.toMotionOrError()
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -36,11 +36,11 @@ class MotionSentencePreviousStartAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextSentenceStart(editor.ij, caret.ij, -operatorArguments.count1)
|
||||
.toMotionOrError()
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -38,11 +38,11 @@ sealed class MotionUnmatchedAction(private val motionChar: Char) : MotionActionH
|
||||
override val motionType: MotionType = MotionType.EXCLUSIVE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion()
|
||||
.moveCaretToUnmatchedBlock(editor.ij, caret.ij, operatorArguments.count1, motionChar)
|
||||
|
@ -24,17 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionWordEndLeftAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextWordEnd(editor.ij, caret.ij, -operatorArguments.count1, false)
|
||||
}
|
||||
|
@ -24,17 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
class MotionWordEndRightAction : MotionActionHandler.ForEachCaret() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToNextWordEnd(editor.ij, caret.ij, operatorArguments.count1, false)
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.awt.event.KeyEvent
|
||||
@ -40,11 +40,11 @@ class MotionWordLeftAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.EXCLUSIVE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().findOffsetOfNextWord(editor.ij, caret.offset.point, -operatorArguments.count1, false)
|
||||
}
|
||||
@ -61,11 +61,11 @@ class MotionWordLeftInsertAction : MotionActionHandler.ForEachCaret(), Complicat
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_STROKE)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().findOffsetOfNextWord(editor.ij, caret.offset.point, -operatorArguments.count1, false)
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.awt.event.KeyEvent
|
||||
@ -40,11 +40,11 @@ class MotionWordRightAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.EXCLUSIVE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().findOffsetOfNextWord(editor.ij, caret.offset.point, operatorArguments.count1, false)
|
||||
}
|
||||
@ -61,11 +61,11 @@ class MotionWordRightInsertAction : MotionActionHandler.ForEachCaret(), Complica
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_STROKE)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().findOffsetOfNextWord(editor.ij, caret.offset.point, operatorArguments.count1, false)
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.awt.event.KeyEvent
|
||||
|
@ -30,7 +30,7 @@ import com.maddyhome.idea.vim.handler.NonShiftedSpecialKeyHandler
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.awt.event.KeyEvent
|
||||
|
@ -32,7 +32,7 @@ import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
@ -40,10 +40,10 @@ sealed class MotionDownBase : MotionActionHandler.ForEachCaret() {
|
||||
private var col: Int = 0
|
||||
|
||||
override fun preOffsetComputation(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
): Boolean {
|
||||
col = EditorHelper.prepareLastColumn(caret.ij)
|
||||
return true
|
||||
@ -59,11 +59,11 @@ open class MotionDownAction : MotionDownBase() {
|
||||
override val motionType: MotionType = MotionType.LINE_WISE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretVertical(editor.ij, caret.ij, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
@ -71,11 +71,11 @@ open class MotionDownAction : MotionDownBase() {
|
||||
|
||||
class MotionDownCtrlNAction : MotionDownAction() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val activeLookup = LookupManager.getActiveLookup(editor.ij)
|
||||
return if (activeLookup != null) {
|
||||
@ -96,11 +96,11 @@ class MotionDownNotLineWiseAction : MotionDownBase() {
|
||||
override val motionType: MotionType = MotionType.EXCLUSIVE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretVertical(editor.ij, caret.ij, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.newapi.injector
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
@ -37,11 +37,11 @@ class MotionDownFirstNonSpaceAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.LINE_WISE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToLineStartSkipLeadingOffset(editor.ij, caret.ij, operatorArguments.count1)
|
||||
.toMotion()
|
||||
@ -52,11 +52,11 @@ class EnterNormalAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.LINE_WISE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val templateState = TemplateManagerImpl.getTemplateState(editor.ij)
|
||||
return if (templateState != null) {
|
||||
|
@ -25,7 +25,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
@ -33,11 +33,11 @@ class MotionDownLess1FirstNonSpaceAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.LINE_WISE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToLineStartSkipLeadingOffset(editor.ij, caret.ij, operatorArguments.count1 - 1)
|
||||
.toMotion()
|
||||
|
@ -29,7 +29,7 @@ import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -40,11 +40,11 @@ class MotionGotoLineFirstAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val line = EditorHelper.normalizeLine(editor.ij, operatorArguments.count1 - 1)
|
||||
return VimPlugin.getMotion().moveCaretToLineWithStartOfLineOption(editor.ij, line, caret.ij).toMotion()
|
||||
@ -57,11 +57,11 @@ class MotionGotoLineFirstInsertAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_CLEAR_STROKES)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val line = EditorHelper.normalizeLine(editor.ij, operatorArguments.count1 - 1)
|
||||
return VimPlugin.getMotion().moveCaretToLineStart(editor.ij, line).toMotion()
|
||||
|
@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -39,11 +39,11 @@ class MotionGotoLineLastAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.LINE_WISE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val line = EditorHelper.normalizeLine(
|
||||
editor.ij,
|
||||
|
@ -30,7 +30,7 @@ import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.helper.inInsertMode
|
||||
import com.maddyhome.idea.vim.helper.inVisualMode
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
||||
@ -44,11 +44,11 @@ class MotionGotoLineLastEndAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
var allow = false
|
||||
if (editor.ij.inInsertMode) {
|
||||
|
@ -29,7 +29,7 @@ import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.util.*
|
||||
@ -38,11 +38,11 @@ class MotionPercentOrMatchAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return if (operatorArguments.count0 == 0) {
|
||||
VimPlugin.getMotion().moveCaretToMatchingPair(editor.ij, caret.ij).toMotionOrError()
|
||||
|
@ -32,7 +32,7 @@ import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
@ -40,10 +40,10 @@ sealed class MotionUpBase : MotionActionHandler.ForEachCaret() {
|
||||
private var col: Int = 0
|
||||
|
||||
override fun preOffsetComputation(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
): Boolean {
|
||||
col = EditorHelper.prepareLastColumn(caret.ij)
|
||||
return true
|
||||
@ -58,11 +58,11 @@ open class MotionUpAction : MotionUpBase() {
|
||||
override val motionType: MotionType = MotionType.LINE_WISE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretVertical(editor.ij, caret.ij, -operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
@ -70,11 +70,11 @@ open class MotionUpAction : MotionUpBase() {
|
||||
|
||||
class MotionUpCtrlPAction : MotionUpAction() {
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
val activeLookup = LookupManager.getActiveLookup(editor.ij)
|
||||
return if (activeLookup != null) {
|
||||
@ -94,11 +94,11 @@ class MotionUpNotLineWiseAction : MotionUpBase() {
|
||||
override val motionType: MotionType = MotionType.EXCLUSIVE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretVertical(editor.ij, caret.ij, -operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotion
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
@ -33,11 +33,11 @@ class MotionUpFirstNonSpaceAction : MotionActionHandler.ForEachCaret() {
|
||||
override val motionType: MotionType = MotionType.LINE_WISE
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return VimPlugin.getMotion().moveCaretToLineStartSkipLeadingOffset(editor.ij, caret.ij, -operatorArguments.count1)
|
||||
.toMotion()
|
||||
|
@ -22,7 +22,7 @@ import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import java.util.*
|
||||
|
||||
|
@ -22,7 +22,7 @@ import com.maddyhome.idea.vim.handler.EditorActionHandlerBase
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import java.util.*
|
||||
|
||||
|
@ -49,7 +49,7 @@ import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import com.maddyhome.idea.vim.helper.getTopLevelEditor
|
||||
import com.maddyhome.idea.vim.helper.vimForEachCaret
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
|
@ -47,7 +47,6 @@ import com.maddyhome.idea.vim.regexp.CharacterClasses;
|
||||
import com.maddyhome.idea.vim.regexp.RegExp;
|
||||
import com.maddyhome.idea.vim.ui.ModalEntry;
|
||||
import com.maddyhome.idea.vim.ui.ex.ExEntryPanel;
|
||||
import com.maddyhome.idea.vim.vimscript.model.Executable;
|
||||
import com.maddyhome.idea.vim.vimscript.model.VimLContext;
|
||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType;
|
||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString;
|
||||
|
@ -33,7 +33,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.helper.vimChangeActionSwitchMode
|
||||
import com.maddyhome.idea.vim.helper.vimLastColumn
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
|
@ -27,7 +27,7 @@ import com.maddyhome.idea.vim.helper.StringHelper
|
||||
import com.maddyhome.idea.vim.helper.commandState
|
||||
import com.maddyhome.idea.vim.helper.noneOfEnum
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.vimLogger
|
||||
import org.jetbrains.annotations.NonNls
|
||||
|
@ -34,7 +34,7 @@ import com.maddyhome.idea.vim.helper.inVisualMode
|
||||
import com.maddyhome.idea.vim.helper.isEndAllowed
|
||||
import com.maddyhome.idea.vim.helper.vimSelectionStart
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
@ -148,11 +148,11 @@ sealed class MotionActionHandler : EditorActionHandlerBase(false) {
|
||||
}
|
||||
|
||||
final override fun baseExecute(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
operatorArguments: OperatorArguments,
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Boolean {
|
||||
val blockSubmodeActive = editor.ij.inBlockSubMode
|
||||
|
||||
|
@ -31,7 +31,7 @@ import com.maddyhome.idea.vim.helper.exitVisualMode
|
||||
import com.maddyhome.idea.vim.helper.inSelectMode
|
||||
import com.maddyhome.idea.vim.helper.inVisualMode
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
||||
|
@ -36,7 +36,7 @@ import com.maddyhome.idea.vim.helper.inVisualMode
|
||||
import com.maddyhome.idea.vim.helper.subMode
|
||||
import com.maddyhome.idea.vim.helper.vimSelectionStart
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
|
@ -24,7 +24,7 @@ import com.intellij.openapi.editor.Editor
|
||||
import com.maddyhome.idea.vim.command.Command
|
||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
|
@ -49,7 +49,7 @@ import com.maddyhome.idea.vim.helper.vimLastSelectionType
|
||||
import com.maddyhome.idea.vim.helper.vimLastVisualOperatorRange
|
||||
import com.maddyhome.idea.vim.helper.vimSelectionStart
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
|
@ -33,7 +33,7 @@ import com.maddyhome.idea.vim.ex.ExOutputModel
|
||||
import com.maddyhome.idea.vim.group.visual.VisualChange
|
||||
import com.maddyhome.idea.vim.group.visual.vimLeadSelectionOffset
|
||||
import com.maddyhome.idea.vim.newapi.IjVimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.ui.ExOutputPanel
|
||||
import kotlin.properties.ReadWriteProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
@ -29,6 +29,9 @@ import com.maddyhome.idea.vim.command.Argument
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.command.SelectionType
|
||||
import com.maddyhome.idea.vim.command.SelectionType.Companion.fromSubMode
|
||||
import com.maddyhome.idea.vim.common.Offset
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.common.offset
|
||||
import com.maddyhome.idea.vim.extension.VimExtensionHandler
|
||||
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||
import com.maddyhome.idea.vim.group.visual.VimSelection.Companion.create
|
||||
@ -38,14 +41,11 @@ import com.maddyhome.idea.vim.helper.VimNlsSafe
|
||||
import com.maddyhome.idea.vim.helper.commandState
|
||||
import com.maddyhome.idea.vim.helper.subMode
|
||||
import com.maddyhome.idea.vim.helper.vimSelectionStart
|
||||
import com.maddyhome.idea.vim.newapi.injector
|
||||
import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor
|
||||
import com.maddyhome.idea.vim.newapi.ExecutionContext
|
||||
import com.maddyhome.idea.vim.newapi.Offset
|
||||
import com.maddyhome.idea.vim.newapi.VimCaret
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.newapi.offset
|
||||
import com.maddyhome.idea.vim.newapi.injector
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
import com.maddyhome.idea.vim.vimscript.model.CommandLineVimLContext
|
||||
import com.maddyhome.idea.vim.vimscript.model.expressions.Expression
|
||||
|
@ -25,16 +25,24 @@ import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.psi.util.PsiUtilBase
|
||||
import com.intellij.util.text.CharArrayUtil
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.command.SelectionType
|
||||
import com.maddyhome.idea.vim.common.EditorLine
|
||||
import com.maddyhome.idea.vim.common.IndentConfig
|
||||
import com.maddyhome.idea.vim.common.OperatedRange
|
||||
import com.maddyhome.idea.vim.common.TextRange
|
||||
import com.maddyhome.idea.vim.common.VimRange
|
||||
import com.maddyhome.idea.vim.common.including
|
||||
import com.maddyhome.idea.vim.common.offset
|
||||
import com.maddyhome.idea.vim.group.ChangeGroup
|
||||
import com.maddyhome.idea.vim.group.MotionGroup
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||
import com.maddyhome.idea.vim.helper.inlayAwareVisualColumn
|
||||
import com.maddyhome.idea.vim.helper.vimChangeActionSwitchMode
|
||||
import com.maddyhome.idea.vim.helper.vimLastColumn
|
||||
import com.maddyhome.idea.vim.vimscript.services.OptionConstants
|
||||
import com.maddyhome.idea.vim.vimscript.services.OptionService
|
||||
|
||||
fun changeRange(
|
||||
editor: Editor,
|
||||
@ -59,7 +67,7 @@ fun changeRange(
|
||||
// Remove the range
|
||||
val vimCaret = IjVimCaret(caret)
|
||||
val indent = editor.offsetToLogicalPosition(vimEditor.indentForLine(vimCaret.getLine().line)).column
|
||||
val deletedInfo = VimMachine.instance.delete(vimRange, vimEditor, vimCaret)
|
||||
val deletedInfo = injector.vimMachine.delete(vimRange, vimEditor, vimCaret)
|
||||
if (deletedInfo != null) {
|
||||
if (deletedInfo is OperatedRange.Lines) {
|
||||
// Add new line in case of linewise motion
|
||||
@ -108,7 +116,7 @@ fun deleteRange(
|
||||
|
||||
val vimCaret = IjVimCaret(caret)
|
||||
vimCaret.caret.vimLastColumn = vimCaret.caret.inlayAwareVisualColumn
|
||||
val deletedInfo = VimMachine.instance.delete(vimRange, vimEditor, vimCaret)
|
||||
val deletedInfo = injector.vimMachine.delete(vimRange, vimEditor, vimCaret)
|
||||
if (deletedInfo != null) {
|
||||
when (deletedInfo) {
|
||||
is OperatedRange.Characters -> {
|
||||
@ -202,3 +210,34 @@ fun insertLineAround(editor: Editor, context: DataContext, shift: Int) {
|
||||
|
||||
MotionGroup.scrollCaretIntoView(editor)
|
||||
}
|
||||
|
||||
fun VimCaret.offsetForLineWithStartOfLineOption(logicalLine: EditorLine.Pointer): Int {
|
||||
val ijEditor = (this.editor as IjVimEditor).editor
|
||||
val caret = (this as IjVimCaret).caret
|
||||
return if (VimPlugin.getOptionService().isSet(OptionService.Scope.LOCAL(editor), OptionConstants.startoflineName)) {
|
||||
offsetForLineStartSkipLeading(logicalLine.line)
|
||||
} else {
|
||||
VimPlugin.getMotion().moveCaretToLineWithSameColumn(ijEditor, logicalLine.line, caret)
|
||||
}
|
||||
}
|
||||
|
||||
fun VimEditor.indentForLine(line: Int): Int {
|
||||
val editor = (this as IjVimEditor).editor
|
||||
return EditorHelper.getLeadingCharacterOffset(editor, line)
|
||||
}
|
||||
|
||||
fun toVimRange(range: TextRange, type: SelectionType): VimRange {
|
||||
return when (type) {
|
||||
SelectionType.LINE_WISE -> {
|
||||
VimRange.Line.Offsets(range.startOffset.offset, range.endOffset.offset)
|
||||
}
|
||||
SelectionType.CHARACTER_WISE -> VimRange.Character.Range(range.startOffset including range.endOffset)
|
||||
SelectionType.BLOCK_WISE -> VimRange.Block(range.startOffset.offset, range.endOffset.offset)
|
||||
}
|
||||
}
|
||||
|
||||
fun OperatedRange.toType() = when (this) {
|
||||
is OperatedRange.Characters -> SelectionType.CHARACTER_WISE
|
||||
is OperatedRange.Lines -> SelectionType.LINE_WISE
|
||||
is OperatedRange.Block -> SelectionType.BLOCK_WISE
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package com.maddyhome.idea.vim.newapi
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.editor.actionSystem.CaretSpecificDataContext
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.helper.EditorDataContext
|
||||
|
||||
/**
|
||||
|
61
src/main/java/com/maddyhome/idea/vim/newapi/IjVimCaret.kt
Normal file
61
src/main/java/com/maddyhome/idea/vim/newapi/IjVimCaret.kt
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim.newapi
|
||||
|
||||
import com.intellij.openapi.editor.Caret
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.common.EditorLine
|
||||
import com.maddyhome.idea.vim.common.Offset
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.common.offset
|
||||
import com.maddyhome.idea.vim.group.MotionGroup
|
||||
|
||||
class IjVimCaret(val caret: Caret) : VimCaret {
|
||||
override val editor: VimEditor
|
||||
get() = IjVimEditor(caret.editor)
|
||||
override val offset: Offset
|
||||
get() = caret.offset.offset
|
||||
|
||||
override fun moveToOffset(offset: Int) {
|
||||
// TODO: 17.12.2021 Unpack internal actions
|
||||
MotionGroup.moveCaret(caret.editor, caret, offset)
|
||||
}
|
||||
|
||||
override fun offsetForLineStartSkipLeading(line: Int): Int {
|
||||
return VimPlugin.getMotion().moveCaretToLineStartSkipLeading((editor as IjVimEditor).editor, line)
|
||||
}
|
||||
|
||||
override fun getLine(): EditorLine.Pointer {
|
||||
return EditorLine.Pointer.init(caret.logicalPosition.line, editor)
|
||||
}
|
||||
|
||||
override fun hasSelection(): Boolean {
|
||||
return caret.hasSelection()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean = this.caret == (other as? IjVimCaret)?.caret
|
||||
|
||||
override fun hashCode(): Int = this.caret.hashCode()
|
||||
}
|
||||
|
||||
val VimCaret.ij: Caret
|
||||
get() = (this as IjVimCaret).caret
|
||||
|
||||
val Caret.vim: VimCaret
|
||||
get() = IjVimCaret(this)
|
182
src/main/java/com/maddyhome/idea/vim/newapi/IjVimEditor.kt
Normal file
182
src/main/java/com/maddyhome/idea/vim/newapi/IjVimEditor.kt
Normal file
@ -0,0 +1,182 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim.newapi
|
||||
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.EditorModificationUtil
|
||||
import com.maddyhome.idea.vim.common.EditorLine
|
||||
import com.maddyhome.idea.vim.common.Offset
|
||||
import com.maddyhome.idea.vim.common.Pointer
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.common.offset
|
||||
import com.maddyhome.idea.vim.helper.fileSize
|
||||
import com.maddyhome.idea.vim.helper.getTopLevelEditor
|
||||
import com.maddyhome.idea.vim.helper.inBlockSubMode
|
||||
|
||||
class IjVimEditor(editor: Editor) : MutableLinearEditor() {
|
||||
|
||||
// All the editor actions should be performed with top level editor!!!
|
||||
// Be careful: all the EditorActionHandler implementation should correctly process InjectedEditors
|
||||
// TBH, I don't like the names. Need to think a bit more about this
|
||||
val editor = editor.getTopLevelEditor()
|
||||
val originalEditor = editor
|
||||
|
||||
override val lfMakesNewLine: Boolean = true
|
||||
|
||||
override fun fileSize(): Long = editor.fileSize.toLong()
|
||||
|
||||
override fun lineCount(): Int {
|
||||
val lineCount = editor.document.lineCount
|
||||
return lineCount.coerceAtLeast(1)
|
||||
}
|
||||
|
||||
override fun deleteRange(leftOffset: Offset, rightOffset: Offset) {
|
||||
editor.document.deleteString(leftOffset.point, rightOffset.point)
|
||||
}
|
||||
|
||||
override fun addLine(atPosition: EditorLine.Offset): EditorLine.Pointer {
|
||||
val offset: Int = if (atPosition.line < lineCount()) {
|
||||
|
||||
// The new line character is inserted before the new line char of the previous line. So it works line an enter
|
||||
// on a line end. I believe that the correct implementation would be to insert the new line char after the
|
||||
// \n of the previous line, however at the moment this won't update the mark on this line.
|
||||
// https://youtrack.jetbrains.com/issue/IDEA-286587
|
||||
|
||||
val lineStart = (editor.document.getLineStartOffset(atPosition.line) - 1).coerceAtLeast(0)
|
||||
val guard = editor.document.getOffsetGuard(lineStart)
|
||||
if (guard != null && guard.endOffset == lineStart + 1) {
|
||||
// Dancing around guarded blocks. It may happen that this concrete position is locked, but the next
|
||||
// (after the new line character) is not. In this case we can actually insert the line after this
|
||||
// new line char
|
||||
// Such thing is often used in pycharm notebooks.
|
||||
lineStart + 1
|
||||
} else {
|
||||
lineStart
|
||||
}
|
||||
} else {
|
||||
fileSize().toInt()
|
||||
}
|
||||
editor.document.insertString(offset, "\n")
|
||||
return EditorLine.Pointer.init(atPosition.line, this)
|
||||
}
|
||||
|
||||
override fun insertText(atPosition: Offset, text: CharSequence) {
|
||||
editor.document.insertString(atPosition.point, text)
|
||||
}
|
||||
|
||||
// TODO: 30.12.2021 Is end offset inclusive?
|
||||
override fun getLineRange(line: EditorLine.Pointer): Pair<Offset, Offset> {
|
||||
// TODO: 30.12.2021 getLineEndOffset returns the same value for "xyz" and "xyz\n"
|
||||
return editor.document.getLineStartOffset(line.line).offset to editor.document.getLineEndOffset(line.line).offset
|
||||
}
|
||||
|
||||
override fun getLine(offset: Offset): EditorLine.Pointer {
|
||||
return EditorLine.Pointer.init(editor.offsetToLogicalPosition(offset.point).line, this)
|
||||
}
|
||||
|
||||
override fun charAt(offset: Pointer): Char {
|
||||
return editor.document.charsSequence[offset.point]
|
||||
}
|
||||
|
||||
override fun carets(): List<VimCaret> {
|
||||
return if (editor.inBlockSubMode) {
|
||||
listOf(IjVimCaret(editor.caretModel.primaryCaret))
|
||||
} else {
|
||||
editor.caretModel.allCarets.map { IjVimCaret(it) }
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("ideavimRunForEachCaret")
|
||||
override fun forEachCaret(action: (VimCaret) -> Unit) {
|
||||
if (editor.inBlockSubMode) {
|
||||
action(IjVimCaret(editor.caretModel.primaryCaret))
|
||||
} else {
|
||||
editor.caretModel.runForEachCaret { action(IjVimCaret(it)) }
|
||||
}
|
||||
}
|
||||
|
||||
override fun primaryCaret(): VimCaret {
|
||||
return IjVimCaret(editor.caretModel.primaryCaret)
|
||||
}
|
||||
|
||||
override fun isWritable(): Boolean {
|
||||
val modificationAllowed = EditorModificationUtil.checkModificationAllowed(editor)
|
||||
val writeRequested = EditorModificationUtil.requestWriting(editor)
|
||||
return modificationAllowed && writeRequested
|
||||
}
|
||||
|
||||
override fun getText(left: Offset, right: Offset): CharSequence {
|
||||
return editor.document.charsSequence.subSequence(left.point, right.point)
|
||||
}
|
||||
|
||||
override fun search(pair: Pair<Offset, Offset>, editor: VimEditor, shiftType: LineDeleteShift): Pair<Pair<Offset, Offset>, LineDeleteShift>? {
|
||||
val ijEditor = (editor as IjVimEditor).editor
|
||||
return when (shiftType) {
|
||||
LineDeleteShift.NO_NL -> if (pair.noGuard(ijEditor)) return pair to shiftType else null
|
||||
LineDeleteShift.NL_ON_END -> {
|
||||
if (pair.noGuard(ijEditor)) return pair to shiftType
|
||||
|
||||
pair.shift(-1, -1) {
|
||||
if (this.noGuard(ijEditor)) return this to LineDeleteShift.NL_ON_START
|
||||
}
|
||||
|
||||
pair.shift(shiftEnd = -1) {
|
||||
if (this.noGuard(ijEditor)) return this to LineDeleteShift.NO_NL
|
||||
}
|
||||
|
||||
null
|
||||
}
|
||||
LineDeleteShift.NL_ON_START -> {
|
||||
if (pair.noGuard(ijEditor)) return pair to shiftType
|
||||
|
||||
pair.shift(shiftStart = 1) {
|
||||
if (this.noGuard(ijEditor)) return this to LineDeleteShift.NO_NL
|
||||
}
|
||||
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Pair<Offset, Offset>.noGuard(editor: Editor): Boolean {
|
||||
return editor.document.getRangeGuard(this.first.point, this.second.point) == null
|
||||
}
|
||||
|
||||
private inline fun Pair<Offset, Offset>.shift(
|
||||
shiftStart: Int = 0,
|
||||
shiftEnd: Int = 0,
|
||||
action: Pair<Offset, Offset>.() -> Unit,
|
||||
) {
|
||||
val data =
|
||||
(this.first.point + shiftStart).coerceAtLeast(0).offset to (this.second.point + shiftEnd).coerceAtLeast(0).offset
|
||||
data.action()
|
||||
}
|
||||
override fun equals(other: Any?): Boolean {
|
||||
error("equals and hashCode should not be used with IjVimEditor")
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
error("equals and hashCode should not be used with IjVimEditor")
|
||||
}
|
||||
}
|
||||
|
||||
val Editor.vim: IjVimEditor
|
||||
get() = IjVimEditor(this)
|
||||
val VimEditor.ij: Editor
|
||||
get() = (this as IjVimEditor).editor
|
@ -21,7 +21,7 @@ package com.maddyhome.idea.vim.newapi
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.project.ProjectManager
|
||||
import com.intellij.openapi.wm.WindowManager
|
||||
import com.maddyhome.idea.vim.common.VimMessages
|
||||
import com.maddyhome.idea.vim.api.VimMessages
|
||||
import com.maddyhome.idea.vim.vimscript.services.OptionConstants
|
||||
import com.maddyhome.idea.vim.vimscript.services.OptionService
|
||||
import java.awt.Toolkit
|
||||
|
@ -1,637 +0,0 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim.newapi
|
||||
|
||||
import com.intellij.openapi.editor.Caret
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.EditorModificationUtil
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.command.SelectionType
|
||||
import com.maddyhome.idea.vim.common.TextRange
|
||||
import com.maddyhome.idea.vim.group.MarkGroup
|
||||
import com.maddyhome.idea.vim.group.MotionGroup
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||
import com.maddyhome.idea.vim.helper.fileSize
|
||||
import com.maddyhome.idea.vim.helper.getTopLevelEditor
|
||||
import com.maddyhome.idea.vim.helper.inBlockSubMode
|
||||
import com.maddyhome.idea.vim.helper.inlayAwareVisualColumn
|
||||
import com.maddyhome.idea.vim.helper.vimLastColumn
|
||||
import com.maddyhome.idea.vim.vimscript.services.OptionConstants
|
||||
import com.maddyhome.idea.vim.vimscript.services.OptionService.Scope.LOCAL
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
/**
|
||||
* Every line in [VimEditor] ends with a new line TODO <- this is probably not true already
|
||||
*
|
||||
* # New line and line count
|
||||
*
|
||||
* In vim **every** line always ends with a new line character. If you'll open a file that doesn't end with
|
||||
* a new line and save it without a modification, the new line character will be automatically added.
|
||||
* This is not how the most editors work. The file and the line may end without a new character symbol.
|
||||
* This affects a [lineCount] function. A three-lines file in vim contains four lines in other editors.
|
||||
* Also this complicated deletion logic.
|
||||
*
|
||||
* At the moment, we consider a what-user-sees approach. A file with two lines where every line ends with
|
||||
* a new line character, is considered as a three-lines file because it's represented in the editor like this.
|
||||
*
|
||||
* TODO: We should understand what logic changes if we use a two or three lines editors.
|
||||
*
|
||||
* ---
|
||||
* # Offset and range deletion
|
||||
*
|
||||
* [Offset] is a position between characters.
|
||||
* [delete] method, that works on offset-offset, deltes the character *between* two offsets. That means that:
|
||||
* - It's possible and simply applicable when the start offset is larger than end offset
|
||||
* - Inclusive/Exclusive words are not applicable to such operation. So we don't define the operation
|
||||
* like "... with end offset exclusive". However, technically, the "right" or the "larger" offset is exclusive.
|
||||
*
|
||||
* ## Other decisions review:
|
||||
* - End offset exclusive:
|
||||
* This is a classic approach, that is used in most APIs, however, it's inconvenient for the case where the
|
||||
* start offset is larger than end offset (direction switching) because for such offset switching it turns that
|
||||
* start offset is exclusive and end offset is inclusive.
|
||||
* - End offset inclusive:
|
||||
* This approach is convenient for direction switching, however, makes the situation that empty range cannot be
|
||||
* specified. E.g. range 1:1 would delete the character under `1`, however it looks like that nothing should be
|
||||
* deleted.
|
||||
* Also, during the development it turned out that using such appriach causes a lot of `+1` and `-1` operations that
|
||||
* seem to be redundant.
|
||||
*
|
||||
* ---
|
||||
* # Offset and pointer
|
||||
*
|
||||
* It seems line it would be helpful to split "string offset" into [Pointer] and [Offset] where [Pointer] referrers
|
||||
* to a concrete existing character and [Offset] referrers to an in-between position.
|
||||
* Apart from semantic improvement (methods like `insertAt(Offset)`, `deleteAt(Pointer)` seem to be more obvious),
|
||||
* looks like it may fix some concrete issues where we pass one type as a parameter, which is a different type.
|
||||
* For example, let's delete a first character on the line. For the classic code it would look like
|
||||
* ```
|
||||
* fun lineStart(line: Int): Int
|
||||
* fun deleteAt(offset: Int)
|
||||
*
|
||||
* val lineStart = data.lineStart(x)
|
||||
* data.deleteAt(lineStart)
|
||||
* ```
|
||||
* This code compiles and looks fine. However, with [Offset] and [Pointer] approach it would fail
|
||||
* ```
|
||||
* fun lineStart(line: Int): Offset // <- return the removed position
|
||||
* fun deleteAt(offset: Pointer)
|
||||
*
|
||||
* val lineStart: Offset = data.lineStart(x)
|
||||
* data.deleteAt(lineStart) // ERROR: incorrect argument type
|
||||
* ```
|
||||
* So, we have to convert the [Offset] to [Pointer] somehow and during the conversion we may observe the problem
|
||||
* that the line may contain no characters at all (at the file end). So the code is either semantically incorrect,
|
||||
* or we should convert an [Offset] to [Pointer] keeping the fact that [Offset] is not exactly the [Pointer].
|
||||
* ```
|
||||
* ...
|
||||
* fun Offset.toPointer(forData: String): Pointer? {
|
||||
* return if (this < forData.length) Pointer(this) else null
|
||||
* }
|
||||
*
|
||||
* val lineFirstCharacter: Pointer = data.lineStart(x).toPointer(data)
|
||||
* if (lineFirstCharacter != null) {
|
||||
* data.deleteAt(lineFirstCharacter)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* ---
|
||||
* # Lines
|
||||
*
|
||||
* We use two types of line reference: Offset and pointer. Offset referrers to a between-lines position.
|
||||
* Pointer referrers to the concrete line.
|
||||
*
|
||||
* TODO We should check if we can keep the same VimEditor instance between edits.
|
||||
* For example, can we store local options right in the editor implementation?
|
||||
*/
|
||||
interface VimEditor {
|
||||
|
||||
val lfMakesNewLine: Boolean
|
||||
|
||||
fun deleteDryRun(range: VimRange): OperatedRange?
|
||||
fun fileSize(): Long
|
||||
|
||||
/**
|
||||
* Vim has always at least one line. When we need to understand that there are no lines, it has a flag "ML_EMPTY"
|
||||
* which indicated that the buffer is empty. However, the line count is still 1.
|
||||
*
|
||||
* The variable for line count is named `ml_line_count` in `memline` structure. There is a single spot where
|
||||
* `0` is assigned to this variable (at the end of `buf_freeall` function), however I'm not sure that this affects
|
||||
* the opened buffer.
|
||||
* Another thing that I don't understand is that I don't see where this variable is updated. There is a small chance
|
||||
* that this variable doesn't present the line count, so I may be wrong and line count can return zero.
|
||||
* I've explored this question by looking at the implementation of ctrl-g command in normal mode.
|
||||
*/
|
||||
fun lineCount(): Int
|
||||
|
||||
fun getLineRange(line: EditorLine.Pointer): Pair<Offset, Offset>
|
||||
fun charAt(offset: Pointer): Char
|
||||
fun carets(): List<VimCaret>
|
||||
|
||||
/**
|
||||
* This method should perform caret merging after the operations. This is similar to IJ runForEachCaret
|
||||
* TODO review
|
||||
*/
|
||||
fun forEachCaret(action: (VimCaret) -> Unit)
|
||||
|
||||
/**
|
||||
* Do we really need this?
|
||||
* TODO
|
||||
*/
|
||||
fun primaryCaret(): VimCaret
|
||||
|
||||
fun isWritable(): Boolean
|
||||
}
|
||||
|
||||
fun VimEditor.indentForLine(line: Int): Int {
|
||||
val editor = (this as IjVimEditor).editor
|
||||
return EditorHelper.getLeadingCharacterOffset(editor, line)
|
||||
}
|
||||
|
||||
interface MutableVimEditor : VimEditor {
|
||||
/**
|
||||
* Returns actually deleted range and the according text, if any.
|
||||
*
|
||||
* TODO: How to make a clear code difference between [delete] and [deleteDryRun]. How to make sure that [deleteDryRun]
|
||||
* will be called before [delete]? Should we call [deleteDryRun] before [delete]?
|
||||
*/
|
||||
fun delete(range: VimRange)
|
||||
fun addLine(atPosition: EditorLine.Offset): EditorLine.Pointer?
|
||||
fun insertText(atPosition: Offset, text: CharSequence)
|
||||
}
|
||||
|
||||
abstract class LinearEditor : VimEditor {
|
||||
abstract fun getLine(offset: Offset): EditorLine.Pointer
|
||||
abstract fun getText(left: Offset, right: Offset): CharSequence
|
||||
}
|
||||
|
||||
abstract class MutableLinearEditor : MutableVimEditor, LinearEditor() {
|
||||
abstract fun deleteRange(leftOffset: Offset, rightOffset: Offset)
|
||||
|
||||
override fun delete(range: VimRange) {
|
||||
when (range) {
|
||||
is VimRange.Block -> TODO()
|
||||
is VimRange.Character.Multiple -> TODO()
|
||||
is VimRange.Character.Range -> {
|
||||
deleteRange(range.offsetAbove(), range.offsetBelow())
|
||||
}
|
||||
is VimRange.Line.Multiple -> TODO()
|
||||
is VimRange.Line.Range -> {
|
||||
val startOffset = getLineRange(range.lineAbove()).first
|
||||
val endOffset = getLineRange(range.lineBelow()).second
|
||||
deleteRange(startOffset, endOffset)
|
||||
}
|
||||
is VimRange.Line.Offsets -> {
|
||||
var startOffset = getLineRange(getLine(range.offsetAbove())).first
|
||||
var endOffset = getLineRange(getLine(range.offsetBelow())).second
|
||||
var shiftType = LineDeleteShift.NO_NL
|
||||
if (endOffset.point < fileSize() && charAt(endOffset.point.pointer) == '\n') {
|
||||
endOffset = (endOffset.point + 1).offset
|
||||
shiftType = LineDeleteShift.NL_ON_END
|
||||
} else if (startOffset.point > 0 && lfMakesNewLine) {
|
||||
startOffset = (startOffset.point - 1).offset
|
||||
shiftType = LineDeleteShift.NL_ON_START
|
||||
}
|
||||
val (newStart, newEnd) = (startOffset to endOffset).search((this as IjVimEditor).editor, shiftType)?.first ?: return
|
||||
deleteRange(newStart, newEnd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun deleteDryRun(range: VimRange): OperatedRange? {
|
||||
return when (range) {
|
||||
is VimRange.Block -> TODO()
|
||||
is VimRange.Character.Multiple -> TODO()
|
||||
is VimRange.Character.Range -> {
|
||||
val textToDelete = getText(range.offsetAbove(), range.offsetBelow())
|
||||
OperatedRange.Characters(textToDelete, range.offsetAbove(), range.offsetBelow())
|
||||
}
|
||||
is VimRange.Line.Multiple -> TODO()
|
||||
is VimRange.Line.Range -> {
|
||||
val startOffset = getLineRange(range.lineAbove()).first
|
||||
val endOffset = getLineRange(range.lineBelow()).second
|
||||
val textToDelete = getText(startOffset, endOffset)
|
||||
TODO()
|
||||
}
|
||||
is VimRange.Line.Offsets -> {
|
||||
val lineAbove = getLine(range.offsetAbove())
|
||||
var startOffset = getLineRange(lineAbove).first
|
||||
val lineBelow = getLine(range.offsetBelow())
|
||||
var endOffset = getLineRange(lineBelow).second
|
||||
var shiftType = LineDeleteShift.NO_NL
|
||||
if (endOffset.point < fileSize() && charAt(endOffset.point.pointer) == '\n') {
|
||||
endOffset = (endOffset.point + 1).offset
|
||||
shiftType = LineDeleteShift.NL_ON_END
|
||||
} else if (startOffset.point > 0 && lfMakesNewLine) {
|
||||
startOffset = (startOffset.point - 1).offset
|
||||
shiftType = LineDeleteShift.NL_ON_START
|
||||
}
|
||||
val data = (startOffset to endOffset).search((this as IjVimEditor).editor, shiftType) ?: return null
|
||||
val (newStart, newEnd) = data.first
|
||||
shiftType = data.second
|
||||
val textToDelete = getText(newStart, newEnd)
|
||||
OperatedRange.Lines(textToDelete, EditorLine.Offset.init(lineAbove.line, this), lineBelow.line - lineAbove.line, shiftType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Pair<Offset, Offset>.search(editor: Editor, shiftType: LineDeleteShift): Pair<Pair<Offset, Offset>, LineDeleteShift>? {
|
||||
|
||||
return when (shiftType) {
|
||||
LineDeleteShift.NO_NL -> if (noGuard(editor)) return this to shiftType else null
|
||||
LineDeleteShift.NL_ON_END -> {
|
||||
if (noGuard(editor)) return this to shiftType
|
||||
|
||||
shift(-1, -1) {
|
||||
if (noGuard(editor)) return this to LineDeleteShift.NL_ON_START
|
||||
}
|
||||
|
||||
shift(shiftEnd = -1) {
|
||||
if (noGuard(editor)) return this to LineDeleteShift.NO_NL
|
||||
}
|
||||
|
||||
null
|
||||
}
|
||||
LineDeleteShift.NL_ON_START -> {
|
||||
if (noGuard(editor)) return this to shiftType
|
||||
|
||||
shift(shiftStart = 1) {
|
||||
if (noGuard(editor)) return this to LineDeleteShift.NO_NL
|
||||
}
|
||||
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Pair<Offset, Offset>.noGuard(editor: Editor): Boolean {
|
||||
return editor.document.getRangeGuard(this.first.point, this.second.point) == null
|
||||
}
|
||||
|
||||
private inline fun Pair<Offset, Offset>.shift(
|
||||
shiftStart: Int = 0,
|
||||
shiftEnd: Int = 0,
|
||||
action: Pair<Offset, Offset>.() -> Unit,
|
||||
) {
|
||||
val data =
|
||||
(this.first.point + shiftStart).coerceAtLeast(0).offset to (this.second.point + shiftEnd).coerceAtLeast(0).offset
|
||||
data.action()
|
||||
}
|
||||
}
|
||||
|
||||
enum class LineDeleteShift {
|
||||
NL_ON_START,
|
||||
NL_ON_END,
|
||||
NO_NL,
|
||||
}
|
||||
|
||||
val Editor.vim: IjVimEditor
|
||||
get() = IjVimEditor(this)
|
||||
val VimEditor.ij: Editor
|
||||
get() = (this as IjVimEditor).editor
|
||||
|
||||
class IjVimEditor(editor: Editor) : MutableLinearEditor() {
|
||||
|
||||
// All the editor actions should be performed with top level editor!!!
|
||||
// Be careful: all the EditorActionHandler implementation should correctly process InjectedEditors
|
||||
// TBH, I don't like the names. Need to think a bit more about this
|
||||
val editor = editor.getTopLevelEditor()
|
||||
val originalEditor = editor
|
||||
|
||||
override val lfMakesNewLine: Boolean = true
|
||||
|
||||
override fun fileSize(): Long = editor.fileSize.toLong()
|
||||
|
||||
override fun lineCount(): Int {
|
||||
val lineCount = editor.document.lineCount
|
||||
return lineCount.coerceAtLeast(1)
|
||||
}
|
||||
|
||||
override fun deleteRange(leftOffset: Offset, rightOffset: Offset) {
|
||||
editor.document.deleteString(leftOffset.point, rightOffset.point)
|
||||
}
|
||||
|
||||
override fun addLine(atPosition: EditorLine.Offset): EditorLine.Pointer {
|
||||
val offset: Int = if (atPosition.line < lineCount()) {
|
||||
|
||||
// The new line character is inserted before the new line char of the previous line. So it works line an enter
|
||||
// on a line end. I believe that the correct implementation would be to insert the new line char after the
|
||||
// \n of the previous line, however at the moment this won't update the mark on this line.
|
||||
// https://youtrack.jetbrains.com/issue/IDEA-286587
|
||||
|
||||
val lineStart = (editor.document.getLineStartOffset(atPosition.line) - 1).coerceAtLeast(0)
|
||||
val guard = editor.document.getOffsetGuard(lineStart)
|
||||
if (guard != null && guard.endOffset == lineStart + 1) {
|
||||
// Dancing around guarded blocks. It may happen that this concrete position is locked, but the next
|
||||
// (after the new line character) is not. In this case we can actually insert the line after this
|
||||
// new line char
|
||||
// Such thing is often used in pycharm notebooks.
|
||||
lineStart + 1
|
||||
} else {
|
||||
lineStart
|
||||
}
|
||||
} else {
|
||||
fileSize().toInt()
|
||||
}
|
||||
editor.document.insertString(offset, "\n")
|
||||
return EditorLine.Pointer.init(atPosition.line, this)
|
||||
}
|
||||
|
||||
override fun insertText(atPosition: Offset, text: CharSequence) {
|
||||
editor.document.insertString(atPosition.point, text)
|
||||
}
|
||||
|
||||
// TODO: 30.12.2021 Is end offset inclusive?
|
||||
override fun getLineRange(line: EditorLine.Pointer): Pair<Offset, Offset> {
|
||||
// TODO: 30.12.2021 getLineEndOffset returns the same value for "xyz" and "xyz\n"
|
||||
return editor.document.getLineStartOffset(line.line).offset to editor.document.getLineEndOffset(line.line).offset
|
||||
}
|
||||
|
||||
override fun getLine(offset: Offset): EditorLine.Pointer {
|
||||
return EditorLine.Pointer.init(editor.offsetToLogicalPosition(offset.point).line, this)
|
||||
}
|
||||
|
||||
override fun charAt(offset: Pointer): Char {
|
||||
return editor.document.charsSequence[offset.point]
|
||||
}
|
||||
|
||||
override fun carets(): List<VimCaret> {
|
||||
return if (editor.inBlockSubMode) {
|
||||
listOf(IjVimCaret(editor.caretModel.primaryCaret))
|
||||
} else {
|
||||
editor.caretModel.allCarets.map { IjVimCaret(it) }
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("ideavimRunForEachCaret")
|
||||
override fun forEachCaret(action: (VimCaret) -> Unit) {
|
||||
if (editor.inBlockSubMode) {
|
||||
action(IjVimCaret(editor.caretModel.primaryCaret))
|
||||
} else {
|
||||
editor.caretModel.runForEachCaret { action(IjVimCaret(it)) }
|
||||
}
|
||||
}
|
||||
|
||||
override fun primaryCaret(): VimCaret {
|
||||
return IjVimCaret(editor.caretModel.primaryCaret)
|
||||
}
|
||||
|
||||
override fun isWritable(): Boolean {
|
||||
val modificationAllowed = EditorModificationUtil.checkModificationAllowed(editor)
|
||||
val writeRequested = EditorModificationUtil.requestWriting(editor)
|
||||
return modificationAllowed && writeRequested
|
||||
}
|
||||
|
||||
override fun getText(left: Offset, right: Offset): CharSequence {
|
||||
return editor.document.charsSequence.subSequence(left.point, right.point)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
error("equals and hashCode should not be used with IjVimEditor")
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
error("equals and hashCode should not be used with IjVimEditor")
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 29.12.2021 Split interface to mutable and immutable
|
||||
interface VimCaret {
|
||||
val editor: VimEditor
|
||||
val offset: Offset
|
||||
fun moveToOffset(offset: Int)
|
||||
fun offsetForLineStartSkipLeading(line: Int): Int
|
||||
fun getLine(): EditorLine.Pointer
|
||||
fun hasSelection(): Boolean
|
||||
}
|
||||
|
||||
val VimCaret.ij: Caret
|
||||
get() = (this as IjVimCaret).caret
|
||||
|
||||
val Caret.vim: VimCaret
|
||||
get() = IjVimCaret(this)
|
||||
|
||||
class IjVimCaret(val caret: Caret) : VimCaret {
|
||||
override val editor: VimEditor
|
||||
get() = IjVimEditor(caret.editor)
|
||||
override val offset: Offset
|
||||
get() = caret.offset.offset
|
||||
|
||||
override fun moveToOffset(offset: Int) {
|
||||
// TODO: 17.12.2021 Unpack internal actions
|
||||
MotionGroup.moveCaret(caret.editor, caret, offset)
|
||||
}
|
||||
|
||||
override fun offsetForLineStartSkipLeading(line: Int): Int {
|
||||
return VimPlugin.getMotion().moveCaretToLineStartSkipLeading((editor as IjVimEditor).editor, line)
|
||||
}
|
||||
|
||||
override fun getLine(): EditorLine.Pointer {
|
||||
return EditorLine.Pointer.init(caret.logicalPosition.line, editor)
|
||||
}
|
||||
|
||||
override fun hasSelection(): Boolean {
|
||||
return caret.hasSelection()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean = this.caret == (other as? IjVimCaret)?.caret
|
||||
|
||||
override fun hashCode(): Int = this.caret.hashCode()
|
||||
}
|
||||
|
||||
fun VimCaret.offsetForLineWithStartOfLineOption(logicalLine: EditorLine.Pointer): Int {
|
||||
val ijEditor = (this.editor as IjVimEditor).editor
|
||||
val caret = (this as IjVimCaret).caret
|
||||
return if (VimPlugin.getOptionService().isSet(LOCAL(editor), OptionConstants.startoflineName)) {
|
||||
offsetForLineStartSkipLeading(logicalLine.line)
|
||||
} else {
|
||||
VimPlugin.getMotion().moveCaretToLineWithSameColumn(ijEditor, logicalLine.line, caret)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Back direction range is possible. `start` is not lower than `end`.
|
||||
* TODO: How to show it in code and namings?
|
||||
* How to separate methods that return "starting from" line and "the above line"
|
||||
*
|
||||
* TODO: How to represent "till last column"
|
||||
*
|
||||
* [VimRange] includes [SelectionType]
|
||||
*
|
||||
* Range normalizations (check if line and offsets really exist) are performed in editor implementations.
|
||||
*/
|
||||
sealed class VimRange {
|
||||
sealed class Line : VimRange() {
|
||||
class Range(val startLine: EditorLine.Pointer, val endLine: EditorLine.Pointer) : Line() {
|
||||
fun lineAbove(): EditorLine.Pointer = listOf(startLine, endLine).minByOrNull { it.line }!!
|
||||
fun lineBelow(): EditorLine.Pointer = listOf(startLine, endLine).maxByOrNull { it.line }!!
|
||||
}
|
||||
|
||||
class Multiple(val lines: List<Int>) : Line()
|
||||
|
||||
// TODO: 11.01.2022 How converting offsets to lines work?
|
||||
class Offsets(val startOffset: Offset, val endOffset: Offset) : Line() {
|
||||
fun offsetAbove(): Offset = min(startOffset.point, endOffset.point).offset
|
||||
fun offsetBelow(): Offset = max(startOffset.point, endOffset.point).offset
|
||||
}
|
||||
}
|
||||
|
||||
sealed class Character : VimRange() {
|
||||
class Range(val range: VimTextRange) : Character() {
|
||||
fun offsetAbove(): Offset = min(range.start.point, range.end.point).offset
|
||||
fun offsetBelow(): Offset = max(range.start.point, range.end.point).offset
|
||||
}
|
||||
|
||||
class Multiple(val ranges: List<VimTextRange>) : Character()
|
||||
}
|
||||
|
||||
class Block(val start: Offset, val end: Offset) : VimRange()
|
||||
}
|
||||
|
||||
fun toVimRange(range: TextRange, type: SelectionType): VimRange {
|
||||
return when (type) {
|
||||
SelectionType.LINE_WISE -> {
|
||||
VimRange.Line.Offsets(range.startOffset.offset, range.endOffset.offset)
|
||||
}
|
||||
SelectionType.CHARACTER_WISE -> VimRange.Character.Range(range.startOffset including range.endOffset)
|
||||
SelectionType.BLOCK_WISE -> VimRange.Block(range.startOffset.offset, range.endOffset.offset)
|
||||
}
|
||||
}
|
||||
|
||||
fun OperatedRange.toType() = when (this) {
|
||||
is OperatedRange.Characters -> SelectionType.CHARACTER_WISE
|
||||
is OperatedRange.Lines -> SelectionType.LINE_WISE
|
||||
is OperatedRange.Block -> SelectionType.BLOCK_WISE
|
||||
}
|
||||
|
||||
fun OperatedRange.toNormalizedTextRange(editor: Editor): TextRange {
|
||||
return when (this) {
|
||||
is OperatedRange.Block -> TODO()
|
||||
is OperatedRange.Lines -> {
|
||||
// TODO: 11.01.2022 This is unsafe
|
||||
val startOffset = editor.document.getLineStartOffset(this.lineAbove.line)
|
||||
val endOffset = editor.document.getLineEndOffset(lineAbove.line + linesOperated)
|
||||
TextRange(startOffset, endOffset)
|
||||
}
|
||||
is OperatedRange.Characters -> TextRange(this.leftOffset.point, this.rightOffset.point)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* `start` is not lower than `end`
|
||||
*/
|
||||
data class VimTextRange(
|
||||
val start: Offset,
|
||||
val end: Offset,
|
||||
) {
|
||||
init {
|
||||
if (start.point > end.point) {
|
||||
println()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
infix fun Int.including(another: Int): VimTextRange {
|
||||
return VimTextRange(this.offset, another.offset)
|
||||
}
|
||||
|
||||
data class Offset(val point: Int)
|
||||
data class Pointer(val point: Int)
|
||||
val Int.offset: Offset
|
||||
get() = Offset(this)
|
||||
val Int.pointer: Pointer
|
||||
get() = Pointer(this)
|
||||
|
||||
interface VimMachine {
|
||||
fun delete(range: VimRange, editor: VimEditor, caret: VimCaret): OperatedRange?
|
||||
|
||||
companion object {
|
||||
val instance = VimMachineImpl()
|
||||
}
|
||||
}
|
||||
|
||||
class VimMachineImpl : VimMachine {
|
||||
/**
|
||||
* The information I'd like to know after the deletion:
|
||||
* - What range is deleted?
|
||||
* - What text is deleted?
|
||||
* - Does text have a new line character at the end?
|
||||
* - At what offset?
|
||||
* - What caret?
|
||||
*/
|
||||
override fun delete(range: VimRange, editor: VimEditor, caret: VimCaret): OperatedRange? {
|
||||
caret as IjVimCaret
|
||||
editor as IjVimEditor
|
||||
// Update the last column before we delete, or we might be retrieving the data for a line that no longer exists
|
||||
caret.caret.vimLastColumn = caret.caret.inlayAwareVisualColumn
|
||||
|
||||
val operatedText = editor.deleteDryRun(range) ?: return null
|
||||
|
||||
val normalizedRange = operatedText.toNormalizedTextRange(editor.editor)
|
||||
VimPlugin.getRegister()
|
||||
.storeText(editor.editor, normalizedRange, operatedText.toType(), true)
|
||||
|
||||
editor.delete(range)
|
||||
|
||||
val start = normalizedRange.startOffset
|
||||
VimPlugin.getMark().setMark(editor.editor, MarkGroup.MARK_CHANGE_POS, start)
|
||||
VimPlugin.getMark().setChangeMarks(editor.editor, TextRange(start, start + 1))
|
||||
|
||||
return operatedText
|
||||
}
|
||||
}
|
||||
|
||||
sealed class EditorLine private constructor(val line: Int) {
|
||||
class Pointer(line: Int) : EditorLine(line) {
|
||||
companion object {
|
||||
fun init(line: Int, forEditor: VimEditor): Pointer {
|
||||
if (line < 0) error("")
|
||||
if (line >= forEditor.lineCount()) error("")
|
||||
return Pointer(line)
|
||||
}
|
||||
}
|
||||
}
|
||||
class Offset(line: Int) : EditorLine(line) {
|
||||
|
||||
fun toPointer(forEditor: VimEditor): Pointer {
|
||||
return Pointer.init(line.coerceAtMost(forEditor.lineCount() - 1), forEditor)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun init(line: Int, forEditor: VimEditor): Offset {
|
||||
if (line < 0) error("")
|
||||
// TODO: 28.12.2021 Is this logic correct?
|
||||
// IJ has an additional line
|
||||
if (line > forEditor.lineCount()) error("")
|
||||
return Offset(line)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sealed class OperatedRange {
|
||||
class Lines(val text: CharSequence, val lineAbove: EditorLine.Offset, val linesOperated: Int, val shiftType: LineDeleteShift) : OperatedRange()
|
||||
class Characters(val text: CharSequence, val leftOffset: Offset, val rightOffset: Offset) : OperatedRange()
|
||||
class Block : OperatedRange() {
|
||||
init {
|
||||
TODO()
|
||||
}
|
||||
}
|
||||
}
|
@ -21,7 +21,8 @@ package com.maddyhome.idea.vim.newapi
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.components.serviceIfCreated
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.maddyhome.idea.vim.common.VimMessages
|
||||
import com.maddyhome.idea.vim.common.VimMachine
|
||||
import com.maddyhome.idea.vim.api.VimMessages
|
||||
import com.maddyhome.idea.vim.diagnostic.VimLogger
|
||||
import com.maddyhome.idea.vim.group.VimChangeGroup
|
||||
import com.maddyhome.idea.vim.group.VimKeyGroup
|
||||
@ -43,6 +44,8 @@ interface VimInjector {
|
||||
val keyGroup: VimKeyGroup
|
||||
val application: VimApplication
|
||||
|
||||
val vimMachine: VimMachine
|
||||
|
||||
// TODO We should somehow state that [OptionServiceImpl] can be used from any implementation
|
||||
val optionService: OptionService
|
||||
}
|
||||
@ -65,6 +68,7 @@ class IjVimInjector : VimInjector {
|
||||
override val keyGroup: VimKeyGroup
|
||||
get() = service()
|
||||
override val application: VimApplication = IjVimApplication()
|
||||
override val vimMachine: VimMachine = VimMachineImpl()
|
||||
|
||||
override val optionService: OptionService
|
||||
get() = service()
|
||||
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim.newapi
|
||||
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.common.OperatedRange
|
||||
import com.maddyhome.idea.vim.common.TextRange
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.common.VimMachine
|
||||
import com.maddyhome.idea.vim.common.VimRange
|
||||
import com.maddyhome.idea.vim.group.MarkGroup
|
||||
import com.maddyhome.idea.vim.helper.inlayAwareVisualColumn
|
||||
import com.maddyhome.idea.vim.helper.vimLastColumn
|
||||
|
||||
class VimMachineImpl : VimMachine {
|
||||
/**
|
||||
* The information I'd like to know after the deletion:
|
||||
* - What range is deleted?
|
||||
* - What text is deleted?
|
||||
* - Does text have a new line character at the end?
|
||||
* - At what offset?
|
||||
* - What caret?
|
||||
*/
|
||||
override fun delete(range: VimRange, editor: VimEditor, caret: VimCaret): OperatedRange? {
|
||||
caret as IjVimCaret
|
||||
editor as IjVimEditor
|
||||
// Update the last column before we delete, or we might be retrieving the data for a line that no longer exists
|
||||
caret.caret.vimLastColumn = caret.caret.inlayAwareVisualColumn
|
||||
|
||||
val operatedText = editor.deleteDryRun(range) ?: return null
|
||||
|
||||
val normalizedRange = operatedText.toNormalizedTextRange(editor.editor)
|
||||
VimPlugin.getRegister()
|
||||
.storeText(editor.editor, normalizedRange, operatedText.toType(), true)
|
||||
|
||||
editor.delete(range)
|
||||
|
||||
val start = normalizedRange.startOffset
|
||||
VimPlugin.getMark().setMark(editor.editor, MarkGroup.MARK_CHANGE_POS, start)
|
||||
VimPlugin.getMark().setChangeMarks(editor.editor, TextRange(start, start + 1))
|
||||
|
||||
return operatedText
|
||||
}
|
||||
}
|
||||
|
||||
fun OperatedRange.toNormalizedTextRange(editor: Editor): TextRange {
|
||||
return when (this) {
|
||||
is OperatedRange.Block -> TODO()
|
||||
is OperatedRange.Lines -> {
|
||||
// TODO: 11.01.2022 This is unsafe
|
||||
val startOffset = editor.document.getLineStartOffset(this.lineAbove.line)
|
||||
val endOffset = editor.document.getLineEndOffset(lineAbove.line + linesOperated)
|
||||
TextRange(startOffset, endOffset)
|
||||
}
|
||||
is OperatedRange.Characters -> TextRange(this.leftOffset.point, this.rightOffset.point)
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ package org.jetbrains.plugins.ideavim.common.editor
|
||||
|
||||
import com.intellij.openapi.application.runWriteAction
|
||||
import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.maddyhome.idea.vim.common.offset
|
||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
||||
import com.maddyhome.idea.vim.newapi.offset
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
class VimEditorTest : VimTestCase() {
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.maddyhome.idea.vim.api
|
||||
|
||||
import com.maddyhome.idea.vim.common.EditorLine
|
||||
import com.maddyhome.idea.vim.common.Offset
|
||||
import com.maddyhome.idea.vim.newapi.VimEditor
|
||||
|
||||
// TODO: 29.12.2021 Split interface to mutable and immutable
|
||||
interface VimCaret {
|
||||
val editor: VimEditor
|
||||
val offset: Offset
|
||||
fun moveToOffset(offset: Int)
|
||||
fun offsetForLineStartSkipLeading(line: Int): Int
|
||||
fun getLine(): EditorLine.Pointer
|
||||
fun hasSelection(): Boolean
|
||||
}
|
257
vim-engine/src/main/java/com/maddyhome/idea/vim/api/VimEditor.kt
Normal file
257
vim-engine/src/main/java/com/maddyhome/idea/vim/api/VimEditor.kt
Normal file
@ -0,0 +1,257 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim.newapi
|
||||
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.common.EditorLine
|
||||
import com.maddyhome.idea.vim.common.Offset
|
||||
import com.maddyhome.idea.vim.common.OperatedRange
|
||||
import com.maddyhome.idea.vim.common.Pointer
|
||||
import com.maddyhome.idea.vim.common.VimRange
|
||||
import com.maddyhome.idea.vim.common.offset
|
||||
import com.maddyhome.idea.vim.common.pointer
|
||||
|
||||
/**
|
||||
* Every line in [VimEditor] ends with a new line TODO <- this is probably not true already
|
||||
*
|
||||
* # New line and line count
|
||||
*
|
||||
* In vim **every** line always ends with a new line character. If you'll open a file that doesn't end with
|
||||
* a new line and save it without a modification, the new line character will be automatically added.
|
||||
* This is not how the most editors work. The file and the line may end without a new character symbol.
|
||||
* This affects a [lineCount] function. A three-lines file in vim contains four lines in other editors.
|
||||
* Also this complicated deletion logic.
|
||||
*
|
||||
* At the moment, we consider a what-user-sees approach. A file with two lines where every line ends with
|
||||
* a new line character, is considered as a three-lines file because it's represented in the editor like this.
|
||||
*
|
||||
* TODO: We should understand what logic changes if we use a two or three lines editors.
|
||||
*
|
||||
* ---
|
||||
* # Offset and range deletion
|
||||
*
|
||||
* [Offset] is a position between characters.
|
||||
* [delete] method, that works on offset-offset, deltes the character *between* two offsets. That means that:
|
||||
* - It's possible and simply applicable when the start offset is larger than end offset
|
||||
* - Inclusive/Exclusive words are not applicable to such operation. So we don't define the operation
|
||||
* like "... with end offset exclusive". However, technically, the "right" or the "larger" offset is exclusive.
|
||||
*
|
||||
* ## Other decisions review:
|
||||
* - End offset exclusive:
|
||||
* This is a classic approach, that is used in most APIs, however, it's inconvenient for the case where the
|
||||
* start offset is larger than end offset (direction switching) because for such offset switching it turns that
|
||||
* start offset is exclusive and end offset is inclusive.
|
||||
* - End offset inclusive:
|
||||
* This approach is convenient for direction switching, however, makes the situation that empty range cannot be
|
||||
* specified. E.g. range 1:1 would delete the character under `1`, however it looks like that nothing should be
|
||||
* deleted.
|
||||
* Also, during the development it turned out that using such appriach causes a lot of `+1` and `-1` operations that
|
||||
* seem to be redundant.
|
||||
*
|
||||
* ---
|
||||
* # Offset and pointer
|
||||
*
|
||||
* It seems line it would be helpful to split "string offset" into [Pointer] and [Offset] where [Pointer] referrers
|
||||
* to a concrete existing character and [Offset] referrers to an in-between position.
|
||||
* Apart from semantic improvement (methods like `insertAt(Offset)`, `deleteAt(Pointer)` seem to be more obvious),
|
||||
* looks like it may fix some concrete issues where we pass one type as a parameter, which is a different type.
|
||||
* For example, let's delete a first character on the line. For the classic code it would look like
|
||||
* ```
|
||||
* fun lineStart(line: Int): Int
|
||||
* fun deleteAt(offset: Int)
|
||||
*
|
||||
* val lineStart = data.lineStart(x)
|
||||
* data.deleteAt(lineStart)
|
||||
* ```
|
||||
* This code compiles and looks fine. However, with [Offset] and [Pointer] approach it would fail
|
||||
* ```
|
||||
* fun lineStart(line: Int): Offset // <- return the removed position
|
||||
* fun deleteAt(offset: Pointer)
|
||||
*
|
||||
* val lineStart: Offset = data.lineStart(x)
|
||||
* data.deleteAt(lineStart) // ERROR: incorrect argument type
|
||||
* ```
|
||||
* So, we have to convert the [Offset] to [Pointer] somehow and during the conversion we may observe the problem
|
||||
* that the line may contain no characters at all (at the file end). So the code is either semantically incorrect,
|
||||
* or we should convert an [Offset] to [Pointer] keeping the fact that [Offset] is not exactly the [Pointer].
|
||||
* ```
|
||||
* ...
|
||||
* fun Offset.toPointer(forData: String): Pointer? {
|
||||
* return if (this < forData.length) Pointer(this) else null
|
||||
* }
|
||||
*
|
||||
* val lineFirstCharacter: Pointer = data.lineStart(x).toPointer(data)
|
||||
* if (lineFirstCharacter != null) {
|
||||
* data.deleteAt(lineFirstCharacter)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* ---
|
||||
* # Lines
|
||||
*
|
||||
* We use two types of line reference: Offset and pointer. Offset referrers to a between-lines position.
|
||||
* Pointer referrers to the concrete line.
|
||||
*
|
||||
* TODO We should check if we can keep the same VimEditor instance between edits.
|
||||
* For example, can we store local options right in the editor implementation?
|
||||
*/
|
||||
interface VimEditor {
|
||||
|
||||
val lfMakesNewLine: Boolean
|
||||
|
||||
fun deleteDryRun(range: VimRange): OperatedRange?
|
||||
fun fileSize(): Long
|
||||
|
||||
/**
|
||||
* Vim has always at least one line. When we need to understand that there are no lines, it has a flag "ML_EMPTY"
|
||||
* which indicated that the buffer is empty. However, the line count is still 1.
|
||||
*
|
||||
* The variable for line count is named `ml_line_count` in `memline` structure. There is a single spot where
|
||||
* `0` is assigned to this variable (at the end of `buf_freeall` function), however I'm not sure that this affects
|
||||
* the opened buffer.
|
||||
* Another thing that I don't understand is that I don't see where this variable is updated. There is a small chance
|
||||
* that this variable doesn't present the line count, so I may be wrong and line count can return zero.
|
||||
* I've explored this question by looking at the implementation of ctrl-g command in normal mode.
|
||||
*/
|
||||
fun lineCount(): Int
|
||||
|
||||
fun getLineRange(line: EditorLine.Pointer): Pair<Offset, Offset>
|
||||
fun charAt(offset: Pointer): Char
|
||||
fun carets(): List<VimCaret>
|
||||
|
||||
/**
|
||||
* This method should perform caret merging after the operations. This is similar to IJ runForEachCaret
|
||||
* TODO review
|
||||
*/
|
||||
fun forEachCaret(action: (VimCaret) -> Unit)
|
||||
|
||||
/**
|
||||
* Do we really need this?
|
||||
* TODO
|
||||
*/
|
||||
fun primaryCaret(): VimCaret
|
||||
|
||||
fun isWritable(): Boolean
|
||||
|
||||
/**
|
||||
* Function for refactoring, get rid of it
|
||||
*/
|
||||
fun search(
|
||||
pair: Pair<Offset, Offset>,
|
||||
editor: VimEditor,
|
||||
shiftType: LineDeleteShift,
|
||||
): Pair<Pair<Offset, Offset>, LineDeleteShift>?
|
||||
}
|
||||
|
||||
interface MutableVimEditor : VimEditor {
|
||||
/**
|
||||
* Returns actually deleted range and the according text, if any.
|
||||
*
|
||||
* TODO: How to make a clear code difference between [delete] and [deleteDryRun]. How to make sure that [deleteDryRun]
|
||||
* will be called before [delete]? Should we call [deleteDryRun] before [delete]?
|
||||
*/
|
||||
fun delete(range: VimRange)
|
||||
fun addLine(atPosition: EditorLine.Offset): EditorLine.Pointer?
|
||||
fun insertText(atPosition: Offset, text: CharSequence)
|
||||
}
|
||||
|
||||
abstract class LinearEditor : VimEditor {
|
||||
abstract fun getLine(offset: Offset): EditorLine.Pointer
|
||||
abstract fun getText(left: Offset, right: Offset): CharSequence
|
||||
}
|
||||
|
||||
abstract class MutableLinearEditor : MutableVimEditor, LinearEditor() {
|
||||
abstract fun deleteRange(leftOffset: Offset, rightOffset: Offset)
|
||||
|
||||
override fun delete(range: VimRange) {
|
||||
when (range) {
|
||||
is VimRange.Block -> TODO()
|
||||
is VimRange.Character.Multiple -> TODO()
|
||||
is VimRange.Character.Range -> {
|
||||
deleteRange(range.offsetAbove(), range.offsetBelow())
|
||||
}
|
||||
is VimRange.Line.Multiple -> TODO()
|
||||
is VimRange.Line.Range -> {
|
||||
val startOffset = getLineRange(range.lineAbove()).first
|
||||
val endOffset = getLineRange(range.lineBelow()).second
|
||||
deleteRange(startOffset, endOffset)
|
||||
}
|
||||
is VimRange.Line.Offsets -> {
|
||||
var startOffset = getLineRange(getLine(range.offsetAbove())).first
|
||||
var endOffset = getLineRange(getLine(range.offsetBelow())).second
|
||||
var shiftType = LineDeleteShift.NO_NL
|
||||
if (endOffset.point < fileSize() && charAt(endOffset.point.pointer) == '\n') {
|
||||
endOffset = (endOffset.point + 1).offset
|
||||
shiftType = LineDeleteShift.NL_ON_END
|
||||
} else if (startOffset.point > 0 && lfMakesNewLine) {
|
||||
startOffset = (startOffset.point - 1).offset
|
||||
shiftType = LineDeleteShift.NL_ON_START
|
||||
}
|
||||
val (newStart, newEnd) = search((startOffset to endOffset), this, shiftType)?.first ?: return
|
||||
deleteRange(newStart, newEnd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun deleteDryRun(range: VimRange): OperatedRange? {
|
||||
return when (range) {
|
||||
is VimRange.Block -> TODO()
|
||||
is VimRange.Character.Multiple -> TODO()
|
||||
is VimRange.Character.Range -> {
|
||||
val textToDelete = getText(range.offsetAbove(), range.offsetBelow())
|
||||
OperatedRange.Characters(textToDelete, range.offsetAbove(), range.offsetBelow())
|
||||
}
|
||||
is VimRange.Line.Multiple -> TODO()
|
||||
is VimRange.Line.Range -> {
|
||||
val startOffset = getLineRange(range.lineAbove()).first
|
||||
val endOffset = getLineRange(range.lineBelow()).second
|
||||
val textToDelete = getText(startOffset, endOffset)
|
||||
TODO()
|
||||
}
|
||||
is VimRange.Line.Offsets -> {
|
||||
val lineAbove = getLine(range.offsetAbove())
|
||||
var startOffset = getLineRange(lineAbove).first
|
||||
val lineBelow = getLine(range.offsetBelow())
|
||||
var endOffset = getLineRange(lineBelow).second
|
||||
var shiftType = LineDeleteShift.NO_NL
|
||||
if (endOffset.point < fileSize() && charAt(endOffset.point.pointer) == '\n') {
|
||||
endOffset = (endOffset.point + 1).offset
|
||||
shiftType = LineDeleteShift.NL_ON_END
|
||||
} else if (startOffset.point > 0 && lfMakesNewLine) {
|
||||
startOffset = (startOffset.point - 1).offset
|
||||
shiftType = LineDeleteShift.NL_ON_START
|
||||
}
|
||||
val data = search((startOffset to endOffset), this, shiftType) ?: return null
|
||||
val (newStart, newEnd) = data.first
|
||||
shiftType = data.second
|
||||
val textToDelete = getText(newStart, newEnd)
|
||||
OperatedRange.Lines(textToDelete,
|
||||
EditorLine.Offset.init(lineAbove.line, this),
|
||||
lineBelow.line - lineAbove.line,
|
||||
shiftType)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum class LineDeleteShift {
|
||||
NL_ON_START,
|
||||
NL_ON_END,
|
||||
NO_NL,
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim.common
|
||||
package com.maddyhome.idea.vim.api
|
||||
|
||||
interface VimMessages {
|
||||
fun showMessage(message: String?)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user