mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-09-18 07:24:48 +02:00
Compare commits
1 Commits
customized
...
54c16c97b9
Author | SHA1 | Date | |
---|---|---|---|
54c16c97b9
|
@@ -47,10 +47,7 @@ class MacroActionTest : VimTestCase() {
|
|||||||
val editor = typeTextInFile(injector.parser.parseKeys("qa" + "3l" + "q"), "on<caret>e two three\n")
|
val editor = typeTextInFile(injector.parser.parseKeys("qa" + "3l" + "q"), "on<caret>e two three\n")
|
||||||
val commandState = editor.vim.vimStateMachine
|
val commandState = editor.vim.vimStateMachine
|
||||||
kotlin.test.assertFalse(commandState.isRecording)
|
kotlin.test.assertFalse(commandState.isRecording)
|
||||||
val registerGroup = VimPlugin.getRegister()
|
assertRegister('a', "3l")
|
||||||
val register = registerGroup.getRegister('a')
|
|
||||||
assertNotNull<Any>(register)
|
|
||||||
kotlin.test.assertEquals("3l", register.text)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -58,9 +55,7 @@ class MacroActionTest : VimTestCase() {
|
|||||||
configureByText("")
|
configureByText("")
|
||||||
enterCommand("imap pp hello")
|
enterCommand("imap pp hello")
|
||||||
typeText(injector.parser.parseKeys("qa" + "i" + "pp<Esc>" + "q"))
|
typeText(injector.parser.parseKeys("qa" + "i" + "pp<Esc>" + "q"))
|
||||||
val register = VimPlugin.getRegister().getRegister('a')
|
assertRegister('a', "ipp<Esc>")
|
||||||
assertNotNull<Any>(register)
|
|
||||||
kotlin.test.assertEquals("ipp<Esc>", injector.parser.toKeyNotation(register.keys))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -68,7 +63,7 @@ class MacroActionTest : VimTestCase() {
|
|||||||
typeTextInFile(injector.parser.parseKeys("qa" + "i" + "<C-K>OK<Esc>" + "q"), "")
|
typeTextInFile(injector.parser.parseKeys("qa" + "i" + "<C-K>OK<Esc>" + "q"), "")
|
||||||
val register = VimPlugin.getRegister().getRegister('a')
|
val register = VimPlugin.getRegister().getRegister('a')
|
||||||
assertNotNull<Any>(register)
|
assertNotNull<Any>(register)
|
||||||
kotlin.test.assertEquals("i<C-K>OK<Esc>", injector.parser.toKeyNotation(register.keys))
|
assertRegister('a', "i<C-K>OK<Esc>")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -141,8 +136,8 @@ class MacroActionTest : VimTestCase() {
|
|||||||
assertState("4\n5\n")
|
assertState("4\n5\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Broken, see the resulting text
|
@Test
|
||||||
fun `ignore test macro with macro`() {
|
fun `test macro with macro`() {
|
||||||
val content = """
|
val content = """
|
||||||
Lorem Ipsum
|
Lorem Ipsum
|
||||||
|
|
||||||
@@ -152,16 +147,55 @@ class MacroActionTest : VimTestCase() {
|
|||||||
Cras id tellus in ex imperdiet egestas.
|
Cras id tellus in ex imperdiet egestas.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(content)
|
configureByText(content)
|
||||||
typeText(injector.parser.parseKeys("qa" + "l" + "q" + "qb" + "10@a" + "q" + "2@b"))
|
typeText(
|
||||||
|
injector.parser.parseKeys(
|
||||||
|
"qa" + "l" + "q" +
|
||||||
|
"qb" + "6@a" + "q" +
|
||||||
|
"^" + "3@b"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
val startOffset = content.rangeOf("rocks").startOffset
|
assertRegister('b', "6@a")
|
||||||
|
assertState("""
|
||||||
|
Lorem Ipsum
|
||||||
|
|
||||||
waitAndAssert {
|
Lorem ipsum dolor ${c}sit amet,
|
||||||
println(fixture.editor.caretModel.offset)
|
consectetur adipiscing elit
|
||||||
println(startOffset)
|
Sed in orci mauris.
|
||||||
println()
|
Cras id tellus in ex imperdiet egestas.
|
||||||
startOffset == fixture.editor.caretModel.offset
|
""".trimIndent())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test macro with macro with macro`() {
|
||||||
|
val content = """
|
||||||
|
Lorem Ipsum
|
||||||
|
|
||||||
|
${c}Lorem ipsum dolor sit amet,
|
||||||
|
consectetur adipiscing elit
|
||||||
|
Sed in orci mauris.
|
||||||
|
Cras id tellus in ex imperdiet egestas.
|
||||||
|
""".trimIndent()
|
||||||
|
configureByText(content)
|
||||||
|
typeText(
|
||||||
|
injector.parser.parseKeys(
|
||||||
|
"qa" + "l" + "q" +
|
||||||
|
"qb" + "3@a" + "q" +
|
||||||
|
"qc" + "2@b" + "q" +
|
||||||
|
"^" + "3@c"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
assertRegister('b', "3@a")
|
||||||
|
assertRegister('c', "2@b")
|
||||||
|
assertState("""
|
||||||
|
Lorem Ipsum
|
||||||
|
|
||||||
|
Lorem ipsum dolor ${c}sit amet,
|
||||||
|
consectetur adipiscing elit
|
||||||
|
Sed in orci mauris.
|
||||||
|
Cras id tellus in ex imperdiet egestas.
|
||||||
|
""".trimIndent())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -445,6 +445,11 @@ abstract class VimTestCase {
|
|||||||
return NeovimTesting.getMark(char)
|
return NeovimTesting.getMark(char)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected fun assertRegister(char: Char, expected: String?) {
|
||||||
|
val actual = injector.registerGroup.getRegister(char)?.keys?.let(injector.parser::toKeyNotation)
|
||||||
|
assertEquals(expected, actual, "Wrong register contents")
|
||||||
|
}
|
||||||
|
|
||||||
protected fun assertState(modeAfter: Mode) {
|
protected fun assertState(modeAfter: Mode) {
|
||||||
assertMode(modeAfter)
|
assertMode(modeAfter)
|
||||||
assertCaretsVisualAttributes()
|
assertCaretsVisualAttributes()
|
||||||
|
@@ -163,10 +163,10 @@ public class KeyHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finishedCommandPreparation(editor, context, editorState, commandBuilder, key, shouldRecord)
|
||||||
} finally {
|
} finally {
|
||||||
handleKeyRecursionCount--
|
handleKeyRecursionCount--
|
||||||
}
|
}
|
||||||
finishedCommandPreparation(editor, context, editorState, commandBuilder, key, shouldRecord)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun finishedCommandPreparation(
|
internal fun finishedCommandPreparation(
|
||||||
|
Reference in New Issue
Block a user