mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-29 01:34:10 +02:00
Fix out of bounds exception
This commit is contained in:
parent
30069564a7
commit
51c464f8d2
src/test/java/org/jetbrains/plugins/ideavim/action/motion/text
vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2003-2023 The IdeaVim authors
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE.txt file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
|
||||
package org.jetbrains.plugins.ideavim.action.motion.text
|
||||
|
||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class MotionSentenceNextStartActionTest : VimTestCase() {
|
||||
@Test
|
||||
fun `test with two empty lines`() {
|
||||
doTest(
|
||||
"C<CR><S-Left><C-Right><C-O>)",
|
||||
"""
|
||||
Lorem ipsum dolor sit amet,
|
||||
consectetur adipiscing elit
|
||||
Sed in orci mauris.
|
||||
Cras id tellus in ${c}ex imperdiet egestas.
|
||||
""".trimIndent(),
|
||||
"""
|
||||
Lorem ipsum dolor sit amet,
|
||||
consectetur adipiscing elit
|
||||
Sed in orci mauris.
|
||||
Cras id tellus in
|
||||
|
||||
""".trimIndent(),
|
||||
VimStateMachine.Mode.INSERT,
|
||||
VimStateMachine.SubMode.NONE,
|
||||
)
|
||||
}
|
||||
}
|
@ -526,7 +526,7 @@ public abstract class VimSearchHelperBase : VimSearchHelper {
|
||||
end?.let { findSentenceEnd(editor, chars, it - 1, max, dir, countCurrent) }
|
||||
}
|
||||
var res: Int? = null
|
||||
if (end != null && (chars[end] != '\n' || !countCurrent)) {
|
||||
if (end != null && end < chars.length && (chars[end] != '\n' || !countCurrent)) {
|
||||
res = end + 1
|
||||
while (res < max) {
|
||||
val ch = chars[res]
|
||||
|
Loading…
Reference in New Issue
Block a user