mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-02-25 02:46:01 +01:00
assuring that visual selection tokens belong to the same cursor
This commit is contained in:
parent
008b3d94fb
commit
e843d9e9c3
vim-engine/src
main/kotlin/com/maddyhome/idea/vim/regexp/nfa/matcher
test/kotlin/com/maddyhome/idea/vim/regexp/internal
@ -23,7 +23,13 @@ internal class VisualAreaMatcher : Matcher {
|
||||
isCaseInsensitive: Boolean,
|
||||
possibleCursors: MutableList<VimCaret>
|
||||
): MatcherResult {
|
||||
return if (index >= editor.currentCaret().selectionStart && index < editor.currentCaret().selectionEnd) MatcherResult.Success(0)
|
||||
else MatcherResult.Failure
|
||||
return if (possibleCursors.any { index >= it.selectionStart && index < it.selectionEnd }) {
|
||||
val newPossibleCursors = possibleCursors.filter { index >= it.selectionStart && index < it.selectionEnd }
|
||||
possibleCursors.clear()
|
||||
possibleCursors.addAll(newPossibleCursors)
|
||||
MatcherResult.Success(0)
|
||||
} else {
|
||||
MatcherResult.Failure
|
||||
}
|
||||
}
|
||||
}
|
@ -1728,6 +1728,20 @@ class NFATest {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test cursor and visual belong to the same cursor`() {
|
||||
doTest(
|
||||
"${START}Lor${END}em Ipsum",
|
||||
"\\%V.\\{-}\\%#.",
|
||||
listOf(
|
||||
mockCaret(0),
|
||||
mockCaret(1),
|
||||
mockCaret(2, Pair(0, 5)),
|
||||
mockCaret(3),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private fun assertFailure(
|
||||
text: CharSequence,
|
||||
|
Loading…
Reference in New Issue
Block a user