mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-04-14 14:15:43 +02:00
Make camelCase motions adjust based on direction of visual selection
This commit is contained in:
parent
de930ed57c
commit
51f15782af
@ -31,6 +31,12 @@ class MotionCamelLeftAction : MotionActionHandler.ForEachCaret() {
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
if (caret.hasSelection() && caret.offset > caret.vimSelectionStart) {
|
||||
val target = injector.searchHelper.findPreviousCamelEnd(editor.text(), caret.offset, operatorArguments.count1)
|
||||
if (target != null && target > caret.vimSelectionStart) {
|
||||
return target.toMotionOrError()
|
||||
}
|
||||
}
|
||||
return injector.searchHelper.findPreviousCamelStart(editor.text(), caret.offset, operatorArguments.count1)
|
||||
?.toMotionOrError() ?: Motion.Error
|
||||
}
|
||||
@ -47,6 +53,10 @@ class MotionCamelRightAction : MotionActionHandler.ForEachCaret() {
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
if (caret.hasSelection() && caret.offset >= caret.vimSelectionStart) {
|
||||
return injector.searchHelper.findNextCamelEnd(editor.text(), caret.offset + 1, operatorArguments.count1)
|
||||
?.toMotionOrError() ?: Motion.Error
|
||||
}
|
||||
return injector.searchHelper.findNextCamelStart(editor.text(), caret.offset + 1, operatorArguments.count1)
|
||||
?.toMotionOrError() ?: Motion.Error
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user