mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-29 19:34:09 +02:00
Remove more deprecated methods
This commit is contained in:
parent
3d08170d54
commit
94d7902ef2
src
main/java/com/maddyhome/idea/vim/extension
test/java/org/jetbrains/plugins/ideavim
action
CopyActionTest.ktMacroActionTest.ktMacroWithEditingTest.ktMultipleCaretsTest.ktSpecialRegistersTest.kt
change/delete
copy
ex
MultipleCaretsTest.kt
implementation/commands
extension/replacewithregister
testFixtures/kotlin/org/jetbrains/plugins/ideavim
tests/java-tests/src/test/kotlin/org/jetbrains/plugins/ideavim/action
vim-engine/src/main/kotlin/com/maddyhome/idea/vim
@ -188,11 +188,19 @@ object VimExtensionFacade {
|
|||||||
|
|
||||||
/** Get the current contents of the given register similar to 'getreg()'. */
|
/** Get the current contents of the given register similar to 'getreg()'. */
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@Deprecated("Please use com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegister(com.maddyhome.idea.vim.api.VimEditor, char)")
|
||||||
fun getRegister(register: Char): List<KeyStroke>? {
|
fun getRegister(register: Char): List<KeyStroke>? {
|
||||||
val reg = VimPlugin.getRegister().getRegister(register) ?: return null
|
val reg = VimPlugin.getRegister().getRegister(register) ?: return null
|
||||||
return reg.keys
|
return reg.keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get the current contents of the given register similar to 'getreg()'. */
|
||||||
|
@JvmStatic
|
||||||
|
fun getRegister(editor: VimEditor, register: Char): List<KeyStroke>? {
|
||||||
|
val reg = VimPlugin.getRegister().getRegister(editor, injector.executionContextManager.getEditorExecutionContext(editor), register) ?: return null
|
||||||
|
return reg.keys
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getRegisterForCaret(register: Char, caret: VimCaret): List<KeyStroke>? {
|
fun getRegisterForCaret(register: Char, caret: VimCaret): List<KeyStroke>? {
|
||||||
val reg = caret.registerStorage.getRegister(register) ?: return null
|
val reg = caret.registerStorage.getRegister(register) ?: return null
|
||||||
|
@ -222,10 +222,10 @@ internal class VimExchangeExtension : VimExtension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val zRegText = getRegister('z')
|
val zRegText = getRegister(editor.vim, 'z')
|
||||||
val unnRegText = getRegister('"')
|
val unnRegText = getRegister(editor.vim, '"')
|
||||||
val startRegText = getRegister('*')
|
val startRegText = getRegister(editor.vim, '*')
|
||||||
val plusRegText = getRegister('+')
|
val plusRegText = getRegister(editor.vim, '+')
|
||||||
runWriteAction {
|
runWriteAction {
|
||||||
// TODO handle:
|
// TODO handle:
|
||||||
// " Compare using =~ because "'==' != 0" returns 0
|
// " Compare using =~ because "'==' != 0" returns 0
|
||||||
@ -299,7 +299,7 @@ internal class VimExchangeExtension : VimExtension {
|
|||||||
|
|
||||||
private fun getExchange(editor: Editor, isVisual: Boolean, selectionType: SelectionType): Exchange {
|
private fun getExchange(editor: Editor, isVisual: Boolean, selectionType: SelectionType): Exchange {
|
||||||
// TODO: improve KeyStroke list to sting conversion
|
// TODO: improve KeyStroke list to sting conversion
|
||||||
fun getRegisterText(reg: Char): String = getRegister(reg)?.map { it.keyChar }?.joinToString("") ?: ""
|
fun getRegisterText(reg: Char): String = getRegister(editor.vim, reg)?.map { it.keyChar }?.joinToString("") ?: ""
|
||||||
fun getMarks(isVisual: Boolean): Pair<Mark, Mark> {
|
fun getMarks(isVisual: Boolean): Pair<Mark, Mark> {
|
||||||
val (startMark, endMark) =
|
val (startMark, endMark) =
|
||||||
if (isVisual) {
|
if (isVisual) {
|
||||||
@ -313,9 +313,9 @@ internal class VimExchangeExtension : VimExtension {
|
|||||||
return Pair(marks.getMark(vimEditor.primaryCaret(), startMark)!!, marks.getMark(vimEditor.primaryCaret(), endMark)!!)
|
return Pair(marks.getMark(vimEditor.primaryCaret(), startMark)!!, marks.getMark(vimEditor.primaryCaret(), endMark)!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
val unnRegText = getRegister('"')
|
val unnRegText = getRegister(editor.vim, '"')
|
||||||
val starRegText = getRegister('*')
|
val starRegText = getRegister(editor.vim, '*')
|
||||||
val plusRegText = getRegister('+')
|
val plusRegText = getRegister(editor.vim, '+')
|
||||||
|
|
||||||
val (selectionStart, selectionEnd) = getMarks(isVisual)
|
val (selectionStart, selectionEnd) = getMarks(isVisual)
|
||||||
if (isVisual) {
|
if (isVisual) {
|
||||||
|
@ -11,6 +11,7 @@ import com.intellij.idea.TestFor
|
|||||||
import com.maddyhome.idea.vim.KeyHandler
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
@ -250,7 +251,10 @@ class CopyActionTest : VimTestCase() {
|
|||||||
enterCommand("set clipboard=unnamed")
|
enterCommand("set clipboard=unnamed")
|
||||||
kotlin.test.assertEquals('*', VimPlugin.getRegister().defaultRegister)
|
kotlin.test.assertEquals('*', VimPlugin.getRegister().defaultRegister)
|
||||||
typeText("yy")
|
typeText("yy")
|
||||||
val starRegister = VimPlugin.getRegister().getRegister('*')
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val starRegister = registerService.getRegister(vimEditor, context, '*')
|
||||||
assertNotNull<Any>(starRegister)
|
assertNotNull<Any>(starRegister)
|
||||||
kotlin.test.assertEquals("bar\n", starRegister.text)
|
kotlin.test.assertEquals("bar\n", starRegister.text)
|
||||||
}
|
}
|
||||||
@ -262,7 +266,10 @@ class CopyActionTest : VimTestCase() {
|
|||||||
fun testLineWiseClipboardYankPaste() {
|
fun testLineWiseClipboardYankPaste() {
|
||||||
configureByText("<caret>foo\n")
|
configureByText("<caret>foo\n")
|
||||||
typeText("\"*yy" + "\"*p")
|
typeText("\"*yy" + "\"*p")
|
||||||
val register = VimPlugin.getRegister().getRegister('*')
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val register = registerService.getRegister(vimEditor, context, '*')
|
||||||
assertNotNull<Any>(register)
|
assertNotNull<Any>(register)
|
||||||
kotlin.test.assertEquals("foo\n", register.text)
|
kotlin.test.assertEquals("foo\n", register.text)
|
||||||
val editor = fixture.editor
|
val editor = fixture.editor
|
||||||
@ -290,7 +297,10 @@ class CopyActionTest : VimTestCase() {
|
|||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
)
|
)
|
||||||
typeText("<C-V>j" + "\"*y" + "\"*p")
|
typeText("<C-V>j" + "\"*y" + "\"*p")
|
||||||
val register = VimPlugin.getRegister().getRegister('*')
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val register = registerService.getRegister(vimEditor, context, '*')
|
||||||
assertNotNull<Any>(register)
|
assertNotNull<Any>(register)
|
||||||
kotlin.test.assertEquals(
|
kotlin.test.assertEquals(
|
||||||
"""
|
"""
|
||||||
|
@ -10,10 +10,10 @@ package org.jetbrains.plugins.ideavim.action
|
|||||||
import com.intellij.idea.TestFor
|
import com.intellij.idea.TestFor
|
||||||
import com.intellij.testFramework.LoggedErrorProcessor
|
import com.intellij.testFramework.LoggedErrorProcessor
|
||||||
import com.maddyhome.idea.vim.KeyHandler
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.api.keys
|
import com.maddyhome.idea.vim.api.keys
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import org.jetbrains.plugins.ideavim.ExceptionHandler
|
import org.jetbrains.plugins.ideavim.ExceptionHandler
|
||||||
import org.jetbrains.plugins.ideavim.OnlyThrowLoggedErrorProcessor
|
import org.jetbrains.plugins.ideavim.OnlyThrowLoggedErrorProcessor
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
@ -58,7 +58,10 @@ class MacroActionTest : VimTestCase() {
|
|||||||
@Test
|
@Test
|
||||||
fun testRecordMacroWithDigraph() {
|
fun testRecordMacroWithDigraph() {
|
||||||
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 vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val register = registerService.getRegister(vimEditor, context, 'a')
|
||||||
assertNotNull<Any>(register)
|
assertNotNull<Any>(register)
|
||||||
assertRegister('a', "i^KOK^[")
|
assertRegister('a', "i^KOK^[")
|
||||||
}
|
}
|
||||||
@ -96,7 +99,10 @@ class MacroActionTest : VimTestCase() {
|
|||||||
configureByText(content)
|
configureByText(content)
|
||||||
typeText(injector.parser.parseKeys("qa" + ":map x y<CR>" + "q"))
|
typeText(injector.parser.parseKeys("qa" + ":map x y<CR>" + "q"))
|
||||||
|
|
||||||
val register = VimPlugin.getRegister().getRegister('a')
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val register = registerService.getRegister(vimEditor, context, 'a')
|
||||||
val registerSize = register!!.keys.size
|
val registerSize = register!!.keys.size
|
||||||
assertEquals(9, registerSize)
|
assertEquals(9, registerSize)
|
||||||
}
|
}
|
||||||
@ -244,8 +250,10 @@ class MacroActionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
injector.keyGroup.putKeyMapping(MappingMode.NXO, keys("abc"), exceptionMappingOwner, ExceptionHandler(), false)
|
injector.keyGroup.putKeyMapping(MappingMode.NXO, keys("abc"), exceptionMappingOwner, ExceptionHandler(), false)
|
||||||
|
|
||||||
injector.registerGroup.storeText('k', "abc")
|
val vimEditor = fixture.editor.vim
|
||||||
injector.registerGroup.storeText('q', "x@ky")
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, 'k', "abc")
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, 'q', "x@ky")
|
||||||
|
|
||||||
val exception = assertThrows<Throwable> {
|
val exception = assertThrows<Throwable> {
|
||||||
LoggedErrorProcessor.executeWith<Throwable>(OnlyThrowLoggedErrorProcessor) {
|
LoggedErrorProcessor.executeWith<Throwable>(OnlyThrowLoggedErrorProcessor) {
|
||||||
|
@ -10,6 +10,7 @@ package org.jetbrains.plugins.ideavim.action
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
@ -29,7 +30,9 @@ class MacroWithEditingTest : VimTestCase() {
|
|||||||
@Test
|
@Test
|
||||||
fun `test copy and perform macro`() {
|
fun `test copy and perform macro`() {
|
||||||
typeTextInFile(injector.parser.parseKeys("^v\$h\"wy"), "iHello")
|
typeTextInFile(injector.parser.parseKeys("^v\$h\"wy"), "iHello")
|
||||||
kotlin.test.assertEquals("iHello", VimPlugin.getRegister().getRegister('w')?.text)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
kotlin.test.assertEquals("iHello", VimPlugin.getRegister().getRegister(vimEditor, context, 'w')?.text)
|
||||||
setText("")
|
setText("")
|
||||||
typeText(injector.parser.parseKeys("@w"))
|
typeText(injector.parser.parseKeys("@w"))
|
||||||
waitAndAssert {
|
waitAndAssert {
|
||||||
@ -40,7 +43,9 @@ class MacroWithEditingTest : VimTestCase() {
|
|||||||
@Test
|
@Test
|
||||||
fun `test copy and perform macro ctrl_a`() {
|
fun `test copy and perform macro ctrl_a`() {
|
||||||
typeTextInFile(injector.parser.parseKeys("^v\$h\"wy"), "\u0001")
|
typeTextInFile(injector.parser.parseKeys("^v\$h\"wy"), "\u0001")
|
||||||
kotlin.test.assertEquals(injector.parser.parseKeys("<C-A>"), injector.registerGroup.getRegister('w')!!.keys)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
kotlin.test.assertEquals(injector.parser.parseKeys("<C-A>"), injector.registerGroup.getRegister(vimEditor, context, 'w')!!.keys)
|
||||||
setText("1")
|
setText("1")
|
||||||
typeText(injector.parser.parseKeys("@w"))
|
typeText(injector.parser.parseKeys("@w"))
|
||||||
waitAndAssert {
|
waitAndAssert {
|
||||||
|
@ -2165,7 +2165,9 @@ rtyfg${c}hzxc"""
|
|||||||
fun testPutTextBeforeCursor() {
|
fun testPutTextBeforeCursor() {
|
||||||
val before = "${c}qwe asd ${c}zxc rty ${c}fgh vbn"
|
val before = "${c}qwe asd ${c}zxc rty ${c}fgh vbn"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "fgh", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "fgh", SelectionType.CHARACTER_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*P" + "3l" + "\"*P"))
|
typeText(injector.parser.parseKeys("\"*P" + "3l" + "\"*P"))
|
||||||
val after = "fghqwfg${c}he asd fghzxfg${c}hc rty fghfgfg${c}hh vbn"
|
val after = "fghqwfg${c}he asd fghzxfg${c}hc rty fghfgfg${c}hh vbn"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -2175,9 +2177,11 @@ rtyfg${c}hzxc"""
|
|||||||
fun testPutTextBeforeCursorOverlapRange() {
|
fun testPutTextBeforeCursorOverlapRange() {
|
||||||
val before = "${c}q${c}we asd zxc rty ${c}fgh vbn"
|
val before = "${c}q${c}we asd zxc rty ${c}fgh vbn"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "fgh")
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "fgh")
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(IjVimEditor(editor), editor.vim.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
.storeText(IjVimEditor(editor), context, editor.vim.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("\"*P"))
|
typeText(injector.parser.parseKeys("\"*P"))
|
||||||
val after = "fg${c}hqfg${c}hwe asd zxc rty fg${c}hfgh vbn"
|
val after = "fg${c}hqfg${c}hwe asd zxc rty fg${c}hfgh vbn"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -2187,7 +2191,9 @@ rtyfg${c}hzxc"""
|
|||||||
fun testPutTextAfterCursor() {
|
fun testPutTextAfterCursor() {
|
||||||
val before = "${c}qwe asd ${c}zxc rty ${c}fgh vbn"
|
val before = "${c}qwe asd ${c}zxc rty ${c}fgh vbn"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "fgh", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "fgh", SelectionType.CHARACTER_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*p" + "3l" + "2\"*p"))
|
typeText(injector.parser.parseKeys("\"*p" + "3l" + "2\"*p"))
|
||||||
val after = "qfghwe fghfg${c}hasd zfghxc fghfg${c}hrty ffghgh fghfg${c}hvbn"
|
val after = "qfghwe fghfg${c}hasd zfghxc fghfg${c}hrty ffghgh fghfg${c}hvbn"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -2197,7 +2203,9 @@ rtyfg${c}hzxc"""
|
|||||||
fun testPutTextAfterCursorOverlapRange() {
|
fun testPutTextAfterCursorOverlapRange() {
|
||||||
val before = "${c}q${c}we asd zxc rty ${c}fgh vbn"
|
val before = "${c}q${c}we asd zxc rty ${c}fgh vbn"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "fgh", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "fgh", SelectionType.CHARACTER_WISE)
|
||||||
typeText(injector.parser.parseKeys("2\"*p"))
|
typeText(injector.parser.parseKeys("2\"*p"))
|
||||||
val after = "qfghfg${c}hwfghfg${c}he asd zxc rty ffghfg${c}hgh vbn"
|
val after = "qfghfg${c}hwfghfg${c}he asd zxc rty ffghfg${c}hgh vbn"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -2212,7 +2220,9 @@ rtyfg${c}hzxc"""
|
|||||||
|
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "zxcvbn\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "zxcvbn\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*P"))
|
typeText(injector.parser.parseKeys("\"*P"))
|
||||||
val after = """
|
val after = """
|
||||||
${c}zxcvbn
|
${c}zxcvbn
|
||||||
@ -2346,7 +2356,9 @@ rtyfg${c}hzxc"""
|
|||||||
|
|
||||||
private fun testPutOverlapLine(before: String, after: String, beforeCursor: Boolean) {
|
private fun testPutOverlapLine(before: String, after: String, beforeCursor: Boolean) {
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "zxcvbn\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "zxcvbn\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*" + if (beforeCursor) "P" else "p"))
|
typeText(injector.parser.parseKeys("\"*" + if (beforeCursor) "P" else "p"))
|
||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
@ -2360,7 +2372,9 @@ rtyfg${c}hzxc"""
|
|||||||
|
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "zxcvbn", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "zxcvbn", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*p"))
|
typeText(injector.parser.parseKeys("\"*p"))
|
||||||
val after = """
|
val after = """
|
||||||
qwerty
|
qwerty
|
||||||
@ -2378,7 +2392,9 @@ rtyfg${c}hzxc"""
|
|||||||
fun testPutTextBeforeCursorMoveCursor() {
|
fun testPutTextBeforeCursorMoveCursor() {
|
||||||
val before = "qw${c}e asd z${c}xc rty ${c}fgh vbn"
|
val before = "qw${c}e asd z${c}xc rty ${c}fgh vbn"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "fgh", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "fgh", SelectionType.CHARACTER_WISE)
|
||||||
typeText(injector.parser.parseKeys("l" + "\"*gP" + "b" + "\"*gP"))
|
typeText(injector.parser.parseKeys("l" + "\"*gP" + "b" + "\"*gP"))
|
||||||
val after = "fgh${c}qwefgh asd fgh${c}zxfghc rty fgh${c}ffghgh vbn"
|
val after = "fgh${c}qwefgh asd fgh${c}zxfghc rty fgh${c}ffghgh vbn"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -2388,7 +2404,9 @@ rtyfg${c}hzxc"""
|
|||||||
fun testPutTextAfterCursorMoveCursor() {
|
fun testPutTextAfterCursorMoveCursor() {
|
||||||
val before = "qw${c}e asd z${c}xc rty ${c}fgh vbn"
|
val before = "qw${c}e asd z${c}xc rty ${c}fgh vbn"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "fgh", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "fgh", SelectionType.CHARACTER_WISE)
|
||||||
typeText(injector.parser.parseKeys("l" + "\"*gp" + "b" + "\"*gp"))
|
typeText(injector.parser.parseKeys("l" + "\"*gp" + "b" + "\"*gp"))
|
||||||
val after = "qwe ffgh${c}ghasd zfgh${c}xcfgh rty ffgh${c}gfghh vbn"
|
val after = "qwe ffgh${c}ghasd zfgh${c}xcfgh rty ffgh${c}gfghh vbn"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -2403,7 +2421,9 @@ rtyfg${c}hzxc"""
|
|||||||
|
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "zxcvbn\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "zxcvbn\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*gP"))
|
typeText(injector.parser.parseKeys("\"*gP"))
|
||||||
val after = """
|
val after = """
|
||||||
zxcvbn
|
zxcvbn
|
||||||
@ -2426,7 +2446,9 @@ rtyfg${c}hzxc"""
|
|||||||
|
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "zxcvbn", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "zxcvbn", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*gp"))
|
typeText(injector.parser.parseKeys("\"*gp"))
|
||||||
val after = """
|
val after = """
|
||||||
qwerty
|
qwerty
|
||||||
@ -2446,7 +2468,9 @@ rtyfg${c}hzxc"""
|
|||||||
* two
|
* two
|
||||||
"""
|
"""
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', " *\n *\n", SelectionType.BLOCK_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', " *\n *\n", SelectionType.BLOCK_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*p"))
|
typeText(injector.parser.parseKeys("\"*p"))
|
||||||
val after = """ * $c *one$c *
|
val after = """ * $c *one$c *
|
||||||
* *two *
|
* *two *
|
||||||
@ -2460,7 +2484,9 @@ rtyfg${c}hzxc"""
|
|||||||
* two
|
* two
|
||||||
"""
|
"""
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', " *\n \n", SelectionType.BLOCK_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', " *\n \n", SelectionType.BLOCK_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*P"))
|
typeText(injector.parser.parseKeys("\"*P"))
|
||||||
val after = """ *$c * on$c *e
|
val after = """ *$c * on$c *e
|
||||||
* tw o
|
* tw o
|
||||||
@ -2479,7 +2505,9 @@ rtyfg${c}hzxc"""
|
|||||||
vb${c}n
|
vb${c}n
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "qwe\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "qwe\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*p"))
|
typeText(injector.parser.parseKeys("\"*p"))
|
||||||
val after = """
|
val after = """
|
||||||
qwe
|
qwe
|
||||||
@ -2501,7 +2529,10 @@ rtyfg${c}hzxc"""
|
|||||||
val before = "qwe ${c}asd ${c}zxc"
|
val before = "qwe ${c}asd ${c}zxc"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
typeText(injector.parser.parseKeys("ye"))
|
typeText(injector.parser.parseKeys("ye"))
|
||||||
val lastRegister = VimPlugin.getRegister().lastRegister
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val lastRegister = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)
|
||||||
assertNotNull<Any>(lastRegister)
|
assertNotNull<Any>(lastRegister)
|
||||||
val text = lastRegister.text
|
val text = lastRegister.text
|
||||||
assertNotNull<Any>(text)
|
assertNotNull<Any>(text)
|
||||||
@ -2523,7 +2554,10 @@ rtyfg${c}hzxc"""
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
typeText(injector.parser.parseKeys("yj"))
|
typeText(injector.parser.parseKeys("yj"))
|
||||||
val lastRegister = VimPlugin.getRegister().lastRegister
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val lastRegister = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)
|
||||||
assertNotNull<Any>(lastRegister)
|
assertNotNull<Any>(lastRegister)
|
||||||
val text = lastRegister.text
|
val text = lastRegister.text
|
||||||
assertNotNull<Any>(text)
|
assertNotNull<Any>(text)
|
||||||
@ -2557,7 +2591,10 @@ rtyfg${c}hzxc"""
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
typeText(injector.parser.parseKeys("2yy"))
|
typeText(injector.parser.parseKeys("2yy"))
|
||||||
val lastRegister = VimPlugin.getRegister().lastRegister
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val lastRegister = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)
|
||||||
assertNotNull<Any>(lastRegister)
|
assertNotNull<Any>(lastRegister)
|
||||||
val text = lastRegister.text
|
val text = lastRegister.text
|
||||||
assertNotNull<Any>(text)
|
assertNotNull<Any>(text)
|
||||||
|
@ -9,6 +9,7 @@ package org.jetbrains.plugins.ideavim.action
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.register.RegisterConstants.LAST_INSERTED_TEXT_REGISTER
|
import com.maddyhome.idea.vim.register.RegisterConstants.LAST_INSERTED_TEXT_REGISTER
|
||||||
import com.maddyhome.idea.vim.register.RegisterConstants.LAST_SEARCH_REGISTER
|
import com.maddyhome.idea.vim.register.RegisterConstants.LAST_SEARCH_REGISTER
|
||||||
import com.maddyhome.idea.vim.register.RegisterConstants.SMALL_DELETION_REGISTER
|
import com.maddyhome.idea.vim.register.RegisterConstants.SMALL_DELETION_REGISTER
|
||||||
@ -210,7 +211,9 @@ class SpecialRegistersTest : VimTestCase() {
|
|||||||
|
|
||||||
private fun getRegisterText(registerName: Char): String? {
|
private fun getRegisterText(registerName: Char): String? {
|
||||||
val registerGroup = VimPlugin.getRegister()
|
val registerGroup = VimPlugin.getRegister()
|
||||||
val register = registerGroup.getRegister(registerName)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val register = registerGroup.getRegister(vimEditor, context, registerName)
|
||||||
assertNotNull<Any>(register)
|
assertNotNull<Any>(register)
|
||||||
return register!!.text
|
return register!!.text
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.change.delete
|
package org.jetbrains.plugins.ideavim.action.change.delete
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
@ -102,7 +103,10 @@ class DeleteMotionActionTest : VimTestCase() {
|
|||||||
expression${c} two
|
expression${c} two
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
)
|
)
|
||||||
val savedText = VimPlugin.getRegister().lastRegister?.text ?: ""
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val savedText = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: ""
|
||||||
kotlin.test.assertEquals(" expression two\n", savedText)
|
kotlin.test.assertEquals(" expression two\n", savedText)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,8 +32,9 @@ class IdeaPutNotificationsTest : VimTestCase() {
|
|||||||
configureByText(before)
|
configureByText(before)
|
||||||
appReadySetup(false)
|
appReadySetup(false)
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
VimPlugin.getRegister()
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("p"))
|
typeText(injector.parser.parseKeys("p"))
|
||||||
|
|
||||||
val notification = notifications().last()
|
val notification = notifications().last()
|
||||||
@ -52,8 +53,9 @@ class IdeaPutNotificationsTest : VimTestCase() {
|
|||||||
configureByText(before)
|
configureByText(before)
|
||||||
appReadySetup(false)
|
appReadySetup(false)
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
VimPlugin.getRegister()
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("p"))
|
typeText(injector.parser.parseKeys("p"))
|
||||||
|
|
||||||
val notifications = notifications()
|
val notifications = notifications()
|
||||||
@ -70,8 +72,9 @@ class IdeaPutNotificationsTest : VimTestCase() {
|
|||||||
configureByText(before)
|
configureByText(before)
|
||||||
appReadySetup(true)
|
appReadySetup(true)
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
VimPlugin.getRegister()
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("p"))
|
typeText(injector.parser.parseKeys("p"))
|
||||||
|
|
||||||
val notifications = EventLog.getLogModel(fixture.project).notifications
|
val notifications = EventLog.getLogModel(fixture.project).notifications
|
||||||
|
@ -15,7 +15,6 @@ import com.intellij.openapi.editor.CaretStateTransferableData
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import com.intellij.testFramework.ExtensionTestUtil
|
import com.intellij.testFramework.ExtensionTestUtil
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
|
||||||
import com.maddyhome.idea.vim.api.globalOptions
|
import com.maddyhome.idea.vim.api.globalOptions
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
@ -87,8 +86,9 @@ class PutTestAfterCursorActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister()
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("p"))
|
typeText(injector.parser.parseKeys("p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -124,9 +124,12 @@ class PutTestAfterCursorActionTest : VimTestCase() {
|
|||||||
// Add Guard to simulate Notebook behaviour. See (VIM-2577)
|
// Add Guard to simulate Notebook behaviour. See (VIM-2577)
|
||||||
val guardRange = before rangeOf "\nGUARD\n"
|
val guardRange = before rangeOf "\nGUARD\n"
|
||||||
editor.document.createGuardedBlock(guardRange.startOffset, guardRange.endOffset)
|
editor.document.createGuardedBlock(guardRange.startOffset, guardRange.endOffset)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
injector.registerGroup.storeText(
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(
|
||||||
vimEditor,
|
vimEditor,
|
||||||
|
context,
|
||||||
vimEditor.primaryCaret(),
|
vimEditor.primaryCaret(),
|
||||||
before rangeOf "I found it in a legendary land\n",
|
before rangeOf "I found it in a legendary land\n",
|
||||||
SelectionType.LINE_WISE,
|
SelectionType.LINE_WISE,
|
||||||
@ -154,10 +157,10 @@ class PutTestAfterCursorActionTest : VimTestCase() {
|
|||||||
${c}where it was settled on some sodden sand
|
${c}where it was settled on some sodden sand
|
||||||
${c}hard by the torrent of a mountain pass.
|
${c}hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val vimEditor = fixture.editor.vim
|
||||||
val vimEditor = editor.vim
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
VimPlugin.getRegister()
|
val registerService = injector.registerGroup
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("vep"))
|
typeText(injector.parser.parseKeys("vep"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
|
@ -29,9 +29,10 @@ class PutTextBeforeCursorActionTest : VimTestCase() {
|
|||||||
where it was settled on some sodden sand
|
where it was settled on some sodden sand
|
||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val vimEditor = fixture.editor.vim
|
||||||
val vimEditor = editor.vim
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
injector.registerGroup.storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "P"))
|
typeText(injector.parser.parseKeys("V" + "P"))
|
||||||
typeText(injector.parser.parseKeys("V" + "P"))
|
typeText(injector.parser.parseKeys("V" + "P"))
|
||||||
val after = """
|
val after = """
|
||||||
|
@ -39,7 +39,10 @@ class PutViaIdeaTest : VimTestCase() {
|
|||||||
val before = "${c}Lorem ipsum dolor sit amet,"
|
val before = "${c}Lorem ipsum dolor sit amet,"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
|
|
||||||
injector.registerGroup.storeText('"', "legendary", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, '"', "legendary", SelectionType.CHARACTER_WISE)
|
||||||
|
|
||||||
typeText("ve", "p")
|
typeText("ve", "p")
|
||||||
val after = "legendar${c}y ipsum dolor sit amet,"
|
val after = "legendar${c}y ipsum dolor sit amet,"
|
||||||
@ -53,8 +56,9 @@ class PutViaIdeaTest : VimTestCase() {
|
|||||||
configureByText(before)
|
configureByText(before)
|
||||||
|
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
VimPlugin.getRegister()
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||||
|
|
||||||
typeText("ppp")
|
typeText("ppp")
|
||||||
val after = "Ilegendarylegendarylegendar${c}y found it in a legendary land"
|
val after = "Ilegendarylegendarylegendar${c}y found it in a legendary land"
|
||||||
@ -70,10 +74,13 @@ class PutViaIdeaTest : VimTestCase() {
|
|||||||
CopyPasteManager.getInstance().setContents(TextBlockTransferable("Fill", emptyList(), null))
|
CopyPasteManager.getInstance().setContents(TextBlockTransferable("Fill", emptyList(), null))
|
||||||
CopyPasteManager.getInstance().setContents(TextBlockTransferable("Buffer", emptyList(), null))
|
CopyPasteManager.getInstance().setContents(TextBlockTransferable("Buffer", emptyList(), null))
|
||||||
|
|
||||||
val vimEditor = fixture.editor.vim
|
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(
|
||||||
vimEditor,
|
vimEditor,
|
||||||
|
context,
|
||||||
vimEditor.primaryCaret(),
|
vimEditor.primaryCaret(),
|
||||||
before rangeOf "legendary$randomUUID",
|
before rangeOf "legendary$randomUUID",
|
||||||
SelectionType.CHARACTER_WISE,
|
SelectionType.CHARACTER_WISE,
|
||||||
@ -98,8 +105,11 @@ class PutViaIdeaTest : VimTestCase() {
|
|||||||
configureByText(before)
|
configureByText(before)
|
||||||
|
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
VimPlugin.getRegister().storeText(
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(
|
||||||
vimEditor,
|
vimEditor,
|
||||||
|
context,
|
||||||
vimEditor.primaryCaret(),
|
vimEditor.primaryCaret(),
|
||||||
before rangeOf "\nLorem ipsum dolor sit amet,\n",
|
before rangeOf "\nLorem ipsum dolor sit amet,\n",
|
||||||
SelectionType.CHARACTER_WISE,
|
SelectionType.CHARACTER_WISE,
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.copy
|
package org.jetbrains.plugins.ideavim.action.copy
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
@ -74,8 +73,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
fun `test put visual text`() {
|
fun `test put visual text`() {
|
||||||
val before = "${c}I found it in a legendary land"
|
val before = "${c}I found it in a legendary land"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||||
val after = "legendar${c}y it in a legendary land"
|
val after = "legendar${c}y it in a legendary land"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -86,8 +89,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
fun `test put visual text twice`() {
|
fun `test put visual text twice`() {
|
||||||
val before = "${c}I found it in a legendary land"
|
val before = "${c}I found it in a legendary land"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("v2e" + "2p"))
|
typeText(injector.parser.parseKeys("v2e" + "2p"))
|
||||||
val after = "legendarylegendar${c}y in a legendary land"
|
val after = "legendarylegendar${c}y in a legendary land"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -98,8 +105,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
fun `test put visual text full line`() {
|
fun `test put visual text full line`() {
|
||||||
val before = "${c}I found it in a legendary land"
|
val before = "${c}I found it in a legendary land"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("v$" + "2p"))
|
typeText(injector.parser.parseKeys("v$" + "2p"))
|
||||||
val after = "legendarylegendar${c}y"
|
val after = "legendarylegendar${c}y"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -110,7 +121,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
fun `test put visual text multicaret`() {
|
fun `test put visual text multicaret`() {
|
||||||
val before = "${c}I found ${c}it in a ${c}legendary land"
|
val before = "${c}I found ${c}it in a ${c}legendary land"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "legendary", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "legendary", SelectionType.CHARACTER_WISE)
|
||||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||||
val after = "legendar${c}y legendar${c}y in a legendar${c}y land"
|
val after = "legendar${c}y legendar${c}y in a legendar${c}y land"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -121,7 +134,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
fun `test put visual text multicaret clipboard register`() {
|
fun `test put visual text multicaret clipboard register`() {
|
||||||
val before = "${c}I found ${c}it in a ${c}legendary land"
|
val before = "${c}I found ${c}it in a ${c}legendary land"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "legendary", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "legendary", SelectionType.CHARACTER_WISE)
|
||||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||||
val after = "legendar${c}y legendar${c}y in a legendar${c}y land"
|
val after = "legendar${c}y legendar${c}y in a legendar${c}y land"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -132,8 +147,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
fun `test put visual text another direction`() {
|
fun `test put visual text another direction`() {
|
||||||
val before = "I foun${c}d it in a legendary land"
|
val before = "I foun${c}d it in a legendary land"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("vb" + "p"))
|
typeText(injector.parser.parseKeys("vb" + "p"))
|
||||||
val after = "I legendar${c}y it in a legendary land"
|
val after = "I legendar${c}y it in a legendary land"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -153,8 +172,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -181,8 +204,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -209,8 +236,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
${c}hard by the torrent of a mountain pass.
|
${c}hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -237,8 +268,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
${c}hard by the torrent of a mountain pass.
|
${c}hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("v$" + "p"))
|
typeText(injector.parser.parseKeys("v$" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -265,7 +300,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
${c}hard by the torrent of a mountain pass.
|
${c}hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "A Discovery\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'*', "A Discovery\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("ve" + "\"*p"))
|
typeText(injector.parser.parseKeys("ve" + "\"*p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -296,7 +333,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
${c}hard by the torrent of a mountain pass.
|
${c}hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "A Discovery\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -327,7 +366,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
${c}hard by the$c torrent of a mountain pass.
|
${c}hard by the$c torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "A Discovery\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -356,7 +397,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
${c}hard by the$c torrent of a mountain pass.
|
${c}hard by the$c torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "A Discovery\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -385,7 +428,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
${c}hard by the$c torrent of a mountain pass.
|
${c}hard by the$c torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "A Discovery\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("ve" + "2\"+p"))
|
typeText(injector.parser.parseKeys("ve" + "2\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -416,7 +461,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
${c}hard by the$c torrent of a mountain pass.
|
${c}hard by the$c torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "A Discovery\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("ve" + "2\"+p"))
|
typeText(injector.parser.parseKeys("ve" + "2\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -454,8 +501,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy underside, the checquered fringe.
|
the dingy underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -490,8 +541,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy ${c}underside, the checquered fringe.
|
the dingy ${c}underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -528,8 +583,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy ${c}underside, the checquered fringe.
|
the dingy ${c}underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("ve" + "2p"))
|
typeText(injector.parser.parseKeys("ve" + "2p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -566,8 +625,10 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy ${c}underside, the checquered fringe.
|
the dingy ${c}underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
// VimPlugin.getRegister().storeText(editor.vim, editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||||
|
// registerService.storeText(editor.vim context,, editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -604,8 +665,10 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy ${c}underside, the checquered fringe.
|
the dingy ${c}underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
// VimPlugin.getRegister().storeText(editor.vim, editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||||
|
// registerService.storeText(editor.vim context,, editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -639,8 +702,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "p"))
|
typeText(injector.parser.parseKeys("V" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -665,8 +732,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "2p"))
|
typeText(injector.parser.parseKeys("V" + "2p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -702,8 +773,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by ${c}the torrent of a mountain pass.
|
hard by ${c}the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "p"))
|
typeText(injector.parser.parseKeys("V" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -739,7 +814,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the ${c}torrent of a mountain pass.
|
hard by the ${c}torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "Discovery", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'*', "Discovery", SelectionType.CHARACTER_WISE)
|
||||||
typeText(injector.parser.parseKeys("V" + "\"*p"))
|
typeText(injector.parser.parseKeys("V" + "\"*p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -775,7 +852,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the ${c}torrent of a mountain pass.
|
hard by the ${c}torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "Discovery", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "Discovery", SelectionType.CHARACTER_WISE)
|
||||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -811,7 +890,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the ${c}torrent of a mountain pass.
|
hard by the ${c}torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "Discovery", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "Discovery", SelectionType.CHARACTER_WISE)
|
||||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -847,7 +928,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the ${c}torrent of a mountain pass.
|
hard by the ${c}torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "Discovery", SelectionType.CHARACTER_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "Discovery", SelectionType.CHARACTER_WISE)
|
||||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -875,8 +958,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "p"))
|
typeText(injector.parser.parseKeys("V" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -901,8 +988,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "2p"))
|
typeText(injector.parser.parseKeys("V" + "2p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -938,8 +1029,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the ${c}torrent of a mountain pass.
|
hard by the ${c}torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "p"))
|
typeText(injector.parser.parseKeys("V" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -975,7 +1070,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the ${c}torrent of a mountain pass.
|
hard by the ${c}torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('*', "A Discovery\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'*', "A Discovery\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("V" + "\"*p"))
|
typeText(injector.parser.parseKeys("V" + "\"*p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1011,7 +1108,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the ${c}torrent of a mountain pass.
|
hard by the ${c}torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "A Discovery\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1047,7 +1146,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the ${c}torrent of a mountain pass.
|
hard by the ${c}torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "A Discovery\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1083,7 +1184,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the ${c}torrent of a mountain pass.
|
hard by the ${c}torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "A Discovery\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1116,8 +1219,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy underside, the checquered fringe.
|
the dingy underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "p"))
|
typeText(injector.parser.parseKeys("V" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1171,8 +1278,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy ${c}underside, the checquered fringe.
|
the dingy ${c}underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "p"))
|
typeText(injector.parser.parseKeys("V" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1232,8 +1343,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy ${c}underside, the checquered fringe.
|
the dingy ${c}underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "2p"))
|
typeText(injector.parser.parseKeys("V" + "2p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1292,7 +1407,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy ${c}underside, the checquered fringe.
|
the dingy ${c}underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1353,7 +1470,9 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy ${c}underside, the checquered fringe.
|
the dingy ${c}underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context,'+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1408,8 +1527,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "p"))
|
typeText(injector.parser.parseKeys("<C-V>2e2j" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1434,8 +1557,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>3e2k" + "p"))
|
typeText(injector.parser.parseKeys("<C-V>3e2k" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1460,8 +1587,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "2p"))
|
typeText(injector.parser.parseKeys("<C-V>2e2j" + "2p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1486,8 +1617,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
ha|rd by the torrent of a mountain pass.
|
ha|rd by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>3j$" + "p"))
|
typeText(injector.parser.parseKeys("<C-V>3j$" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1525,8 +1660,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "p"))
|
typeText(injector.parser.parseKeys("<C-V>2e2j" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1553,8 +1692,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "P"))
|
typeText(injector.parser.parseKeys("<C-V>2e2j" + "P"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1592,8 +1735,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "2p"))
|
typeText(injector.parser.parseKeys("<C-V>2e2j" + "2p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1632,8 +1779,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
ha|rd by| the torrent of a mountain pass.
|
ha|rd by| the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>2e3j" + "p"))
|
typeText(injector.parser.parseKeys("<C-V>2e3j" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1671,8 +1822,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>2j$" + "p"))
|
typeText(injector.parser.parseKeys("<C-V>2j$" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1706,8 +1861,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy underside, the checquered fringe.
|
the dingy underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "p"))
|
typeText(injector.parser.parseKeys("<C-V>2e2j" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1742,8 +1901,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the |dingy un|derside, the checquered fringe.
|
the |dingy un|derside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>2e3j" + "p"))
|
typeText(injector.parser.parseKeys("<C-V>2e3j" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1778,8 +1941,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy underside, the checquered fringe.
|
the dingy underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>2ej" + "p"))
|
typeText(injector.parser.parseKeys("<C-V>2ej" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1815,7 +1982,10 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>elj" + "p"))
|
typeText(injector.parser.parseKeys("<C-V>elj" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
@ -1851,8 +2021,12 @@ class PutVisualTextActionTest : VimTestCase() {
|
|||||||
the dingy underside, the checquered fringe.
|
the dingy underside, the checquered fringe.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-V>2j$" + "p"))
|
typeText(injector.parser.parseKeys("<C-V>2j$" + "p"))
|
||||||
val after = """
|
val after = """
|
||||||
A Discovery
|
A Discovery
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.copy
|
package org.jetbrains.plugins.ideavim.action.copy
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
@ -33,7 +32,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
val before = "${c}I found it in a legendary land"
|
val before = "${c}I found it in a legendary land"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("v2e" + "2gp"))
|
typeText(injector.parser.parseKeys("v2e" + "2gp"))
|
||||||
val after = "legendarylegendary$c in a legendary land"
|
val after = "legendarylegendary$c in a legendary land"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -45,7 +46,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
val before = "${c}I found it in a legendary land"
|
val before = "${c}I found it in a legendary land"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("v2e" + "gp"))
|
typeText(injector.parser.parseKeys("v2e" + "gp"))
|
||||||
val after = """
|
val after = """
|
||||||
|
|
||||||
@ -61,7 +64,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
val before = "${c}I found it in a legendary land"
|
val before = "${c}I found it in a legendary land"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "gp"))
|
typeText(injector.parser.parseKeys("V" + "gp"))
|
||||||
val after = "legendary\n$c"
|
val after = "legendary\n$c"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -88,7 +93,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(file)
|
val editor = configureByText(file)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), TextRange(2, 11), SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(2, 11), SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "gp"))
|
typeText(injector.parser.parseKeys("V" + "gp"))
|
||||||
assertState(newFile)
|
assertState(newFile)
|
||||||
}
|
}
|
||||||
@ -134,7 +141,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
val before = "${c}I found it in a legendary land"
|
val before = "${c}I found it in a legendary land"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("v2e" + "gP"))
|
typeText(injector.parser.parseKeys("v2e" + "gP"))
|
||||||
val after = """
|
val after = """
|
||||||
|
|
||||||
@ -150,7 +159,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
val before = "${c}I found it in a legendary land"
|
val before = "${c}I found it in a legendary land"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("v2e" + "2gP"))
|
typeText(injector.parser.parseKeys("v2e" + "2gP"))
|
||||||
val after = "legendarylegendary$c in a legendary land"
|
val after = "legendarylegendary$c in a legendary land"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -162,7 +173,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
val before = "${c}I found it in a legendary land"
|
val before = "${c}I found it in a legendary land"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("v$" + "2gP"))
|
typeText(injector.parser.parseKeys("v$" + "2gP"))
|
||||||
val after = "legendarylegendar${c}y"
|
val after = "legendarylegendar${c}y"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -174,7 +187,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
val before = "${c}I found it in a legendary land"
|
val before = "${c}I found it in a legendary land"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "gP"))
|
typeText(injector.parser.parseKeys("V" + "gP"))
|
||||||
val after = "legendary\n$c"
|
val after = "legendary\n$c"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
@ -215,7 +230,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
|
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "zxcvbn\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '+', "zxcvbn\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("vl" + "\"+gp"))
|
typeText(injector.parser.parseKeys("vl" + "\"+gp"))
|
||||||
val after = """
|
val after = """
|
||||||
q
|
q
|
||||||
@ -243,7 +260,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
|
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
injector.registerGroup.storeText('+', "zxcvbn\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '+', "zxcvbn\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("vl" + "\"+gp"))
|
typeText(injector.parser.parseKeys("vl" + "\"+gp"))
|
||||||
val after = """
|
val after = """
|
||||||
q
|
q
|
||||||
@ -273,7 +292,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.BLOCK_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.BLOCK_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<S-v>" + "gp"))
|
typeText(injector.parser.parseKeys("<S-v>" + "gp"))
|
||||||
val after = """
|
val after = """
|
||||||
${c}fgh
|
${c}fgh
|
||||||
@ -299,7 +320,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.LINE_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.LINE_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("<C-v>" + "h" + "gp"))
|
typeText(injector.parser.parseKeys("<C-v>" + "h" + "gp"))
|
||||||
val after = """
|
val after = """
|
||||||
q
|
q
|
||||||
@ -320,7 +343,9 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
|||||||
val before = "${c}qwe asd ${c}zxc rty ${c}fgh vbn"
|
val before = "${c}qwe asd ${c}zxc rty ${c}fgh vbn"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
VimPlugin.getRegister().storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("v2e" + "2gp"))
|
typeText(injector.parser.parseKeys("v2e" + "2gp"))
|
||||||
val after = "fghfgh$c fghfgh$c fghfgh$c"
|
val after = "fghfgh$c fghfgh$c fghfgh$c"
|
||||||
assertState(after)
|
assertState(after)
|
||||||
|
@ -10,6 +10,7 @@ package org.jetbrains.plugins.ideavim.action.copy
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
@ -22,7 +23,9 @@ class YankLineActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
typeText(injector.parser.parseKeys("\"4yy"))
|
typeText(injector.parser.parseKeys("\"4yy"))
|
||||||
val register = VimPlugin.getRegister().getRegister('4')!!
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val register = VimPlugin.getRegister().getRegister(vimEditor, context, '4')!!
|
||||||
kotlin.test.assertEquals("Lorem ipsum dolor sit amet,\n", register.text)
|
kotlin.test.assertEquals("Lorem ipsum dolor sit amet,\n", register.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.copy
|
package org.jetbrains.plugins.ideavim.action.copy
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
@ -25,7 +25,10 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
Cras id tellus in ex imperdiet egestas.
|
Cras id tellus in ex imperdiet egestas.
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
typeTextInFile("yW", file)
|
typeTextInFile("yW", file)
|
||||||
val text = VimPlugin.getRegister().lastRegister?.text ?: kotlin.test.fail()
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val text = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||||
|
|
||||||
kotlin.test.assertEquals("and", text)
|
kotlin.test.assertEquals("and", text)
|
||||||
}
|
}
|
||||||
@ -55,10 +58,13 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
enterCommand("set clipboard=unnamed")
|
enterCommand("set clipboard=unnamed")
|
||||||
typeText("yiw")
|
typeText("yiw")
|
||||||
|
|
||||||
val starRegister = VimPlugin.getRegister().getRegister('*') ?: kotlin.test.fail("Register * is empty")
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val starRegister = registerService.getRegister(vimEditor, context, '*') ?: kotlin.test.fail("Register * is empty")
|
||||||
kotlin.test.assertEquals("legendary", starRegister.text)
|
kotlin.test.assertEquals("legendary", starRegister.text)
|
||||||
|
|
||||||
val quoteRegister = VimPlugin.getRegister().getRegister('"') ?: kotlin.test.fail("Register \" is empty")
|
val quoteRegister = registerService.getRegister(vimEditor, context, '"') ?: kotlin.test.fail("Register \" is empty")
|
||||||
kotlin.test.assertEquals("legendary", quoteRegister.text)
|
kotlin.test.assertEquals("legendary", quoteRegister.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,10 +74,13 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
configureByText("I found it in a ${c}legendary land")
|
configureByText("I found it in a ${c}legendary land")
|
||||||
typeText("\"zyiw")
|
typeText("\"zyiw")
|
||||||
|
|
||||||
val starRegister = VimPlugin.getRegister().getRegister('z') ?: kotlin.test.fail("Register z is empty")
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val starRegister = registerService.getRegister(vimEditor, context, 'z') ?: kotlin.test.fail("Register z is empty")
|
||||||
kotlin.test.assertEquals("legendary", starRegister.text)
|
kotlin.test.assertEquals("legendary", starRegister.text)
|
||||||
|
|
||||||
val quoteRegister = VimPlugin.getRegister().getRegister('"') ?: kotlin.test.fail("Register \" is empty")
|
val quoteRegister = registerService.getRegister(vimEditor, context, '"') ?: kotlin.test.fail("Register \" is empty")
|
||||||
kotlin.test.assertEquals("legendary", quoteRegister.text)
|
kotlin.test.assertEquals("legendary", quoteRegister.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +90,10 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
configureByText("I found it in a ${c}legendary land")
|
configureByText("I found it in a ${c}legendary land")
|
||||||
typeText("\"zyiw")
|
typeText("\"zyiw")
|
||||||
|
|
||||||
val quoteRegister = VimPlugin.getRegister().getRegister('"') ?: kotlin.test.fail("Register \" is empty")
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val quoteRegister = registerService.getRegister(vimEditor, context, '"') ?: kotlin.test.fail("Register \" is empty")
|
||||||
kotlin.test.assertEquals("legendary", quoteRegister.text)
|
kotlin.test.assertEquals("legendary", quoteRegister.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +124,10 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
$c
|
$c
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
typeTextInFile("y$", file)
|
typeTextInFile("y$", file)
|
||||||
val text = VimPlugin.getRegister().lastRegister?.text ?: kotlin.test.fail()
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val text = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||||
|
|
||||||
kotlin.test.assertEquals("", text)
|
kotlin.test.assertEquals("", text)
|
||||||
}
|
}
|
||||||
@ -129,7 +144,10 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
typeTextInFile(commandToKeys("map * *zz"), file)
|
typeTextInFile(commandToKeys("map * *zz"), file)
|
||||||
typeTextInFile("\"*yiw", file)
|
typeTextInFile("\"*yiw", file)
|
||||||
val text = VimPlugin.getRegister().lastRegister?.text ?: kotlin.test.fail()
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val text = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||||
|
|
||||||
kotlin.test.assertEquals("legendary", text)
|
kotlin.test.assertEquals("legendary", text)
|
||||||
}
|
}
|
||||||
@ -146,7 +164,10 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
typeTextInFile(commandToKeys("map * *yiw"), file)
|
typeTextInFile(commandToKeys("map * *yiw"), file)
|
||||||
typeTextInFile("\"*", file)
|
typeTextInFile("\"*", file)
|
||||||
kotlin.test.assertNull(VimPlugin.getRegister().lastRegister?.text)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
kotlin.test.assertNull(registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -161,7 +182,10 @@ class YankMotionActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|
||||||
doTest("yy", file, file)
|
doTest("yy", file, file)
|
||||||
val text = VimPlugin.getRegister().lastRegister?.text ?: kotlin.test.fail()
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val text = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||||
|
|
||||||
kotlin.test.assertEquals("hard by the torrent of a mountain pass.\n", text)
|
kotlin.test.assertEquals("hard by the torrent of a mountain pass.\n", text)
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.copy
|
package org.jetbrains.plugins.ideavim.action.copy
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
@ -90,8 +89,9 @@ class YankVisualActionTest : VimTestCase() {
|
|||||||
configureByText(text)
|
configureByText(text)
|
||||||
typeText(injector.parser.parseKeys("viw" + "y"))
|
typeText(injector.parser.parseKeys("viw" + "y"))
|
||||||
val editor = fixture.editor.vim
|
val editor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(editor)
|
||||||
val lastRegister = injector.registerGroup.lastRegisterChar
|
val lastRegister = injector.registerGroup.lastRegisterChar
|
||||||
val registers = editor.carets().map { it.registerStorage.getRegister(lastRegister)?.text }
|
val registers = editor.carets().map { it.registerStorage.getRegister(editor, context, lastRegister)?.text }
|
||||||
kotlin.test.assertEquals(listOf("found", "was"), registers)
|
kotlin.test.assertEquals(listOf("found", "was"), registers)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,10 @@ class YankVisualActionTest : VimTestCase() {
|
|||||||
configureByText(before)
|
configureByText(before)
|
||||||
typeText(injector.parser.parseKeys("vey"))
|
typeText(injector.parser.parseKeys("vey"))
|
||||||
|
|
||||||
val lastRegister = VimPlugin.getRegister().lastRegister
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val lastRegister = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)
|
||||||
assertNotNull<Any>(lastRegister)
|
assertNotNull<Any>(lastRegister)
|
||||||
val text = lastRegister.text
|
val text = lastRegister.text
|
||||||
assertNotNull<Any>(text)
|
assertNotNull<Any>(text)
|
||||||
@ -171,8 +174,9 @@ class YankVisualActionTest : VimTestCase() {
|
|||||||
configureByText(text)
|
configureByText(text)
|
||||||
typeText(injector.parser.parseKeys("V" + "y"))
|
typeText(injector.parser.parseKeys("V" + "y"))
|
||||||
val editor = fixture.editor.vim
|
val editor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(editor)
|
||||||
val lastRegister = injector.registerGroup.lastRegisterChar
|
val lastRegister = injector.registerGroup.lastRegisterChar
|
||||||
val registers = editor.carets().map { it.registerStorage.getRegister(lastRegister)?.text }
|
val registers = editor.carets().map { it.registerStorage.getRegister(editor, context, lastRegister)?.text }
|
||||||
kotlin.test.assertEquals(
|
kotlin.test.assertEquals(
|
||||||
listOf("all rocks and lavender and tufted grass,\n", "hard by the torrent of a mountain pass.\n"),
|
listOf("all rocks and lavender and tufted grass,\n", "hard by the torrent of a mountain pass.\n"),
|
||||||
registers,
|
registers,
|
||||||
@ -307,7 +311,10 @@ class YankVisualActionTest : VimTestCase() {
|
|||||||
configureByText(before)
|
configureByText(before)
|
||||||
typeText(keys)
|
typeText(keys)
|
||||||
|
|
||||||
val lastRegister = VimPlugin.getRegister().lastRegister!!
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val lastRegister = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)!!
|
||||||
val text = lastRegister.text
|
val text = lastRegister.text
|
||||||
val type = lastRegister.type
|
val type = lastRegister.type
|
||||||
kotlin.test.assertEquals(expectedText, text)
|
kotlin.test.assertEquals(expectedText, text)
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.copy
|
package org.jetbrains.plugins.ideavim.action.copy
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
@ -35,7 +35,10 @@ class YankVisualLinesActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(text)
|
configureByText(text)
|
||||||
typeText(injector.parser.parseKeys("vjY"))
|
typeText(injector.parser.parseKeys("vjY"))
|
||||||
val savedText = VimPlugin.getRegister().lastRegister?.text ?: kotlin.test.fail()
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val savedText = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||||
kotlin.test.assertEquals(yankedTest, savedText)
|
kotlin.test.assertEquals(yankedTest, savedText)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +66,10 @@ class YankVisualLinesActionTest : VimTestCase() {
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
|
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val savedText = VimPlugin.getRegister().lastRegister?.text ?: kotlin.test.fail()
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val savedText = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||||
kotlin.test.assertEquals(yankedTest, savedText)
|
kotlin.test.assertEquals(yankedTest, savedText)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +90,10 @@ class YankVisualLinesActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
configureByText(text)
|
configureByText(text)
|
||||||
typeText(injector.parser.parseKeys("VjY"))
|
typeText(injector.parser.parseKeys("VjY"))
|
||||||
val savedText = VimPlugin.getRegister().lastRegister?.text ?: kotlin.test.fail()
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val savedText = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||||
kotlin.test.assertEquals(yankedTest, savedText)
|
kotlin.test.assertEquals(yankedTest, savedText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
package org.jetbrains.plugins.ideavim.ex
|
package org.jetbrains.plugins.ideavim.ex
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
@ -129,8 +130,9 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(commandToKeys("pu"))
|
typeText(commandToKeys("pu"))
|
||||||
val after = """
|
val after = """
|
||||||
qwe
|
qwe
|
||||||
@ -164,8 +166,9 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(commandToKeys("pu"))
|
typeText(commandToKeys("pu"))
|
||||||
val after = """
|
val after = """
|
||||||
qwe
|
qwe
|
||||||
@ -200,8 +203,9 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(commandToKeys("4pu"))
|
typeText(commandToKeys("4pu"))
|
||||||
val after = """
|
val after = """
|
||||||
qwe
|
qwe
|
||||||
@ -236,8 +240,9 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
val vimEditor = editor.vim
|
val vimEditor = editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(commandToKeys("4pu"))
|
typeText(commandToKeys("4pu"))
|
||||||
val after = """
|
val after = """
|
||||||
qwe
|
qwe
|
||||||
@ -257,8 +262,10 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
fun testPutVisualLines() {
|
fun testPutVisualLines() {
|
||||||
val before = "${c}qwe\n" + "rty\n" + "as${c}d\n" + "fgh\n" + "zxc\n" + "vbn\n"
|
val before = "${c}qwe\n" + "rty\n" + "as${c}d\n" + "fgh\n" + "zxc\n" + "vbn\n"
|
||||||
val editor = configureByText(before)
|
val editor = configureByText(before)
|
||||||
|
val vimEditor = editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(editor.vim, editor.vim.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, editor.vim.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
||||||
|
|
||||||
typeText("vj")
|
typeText("vj")
|
||||||
typeText(commandToKeys("pu"))
|
typeText(commandToKeys("pu"))
|
||||||
@ -309,7 +316,10 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
configureByText(before)
|
configureByText(before)
|
||||||
typeText(commandToKeys("y"))
|
typeText(commandToKeys("y"))
|
||||||
|
|
||||||
val lastRegister = VimPlugin.getRegister().lastRegister
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val lastRegister = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)
|
||||||
assertNotNull<Any>(lastRegister)
|
assertNotNull<Any>(lastRegister)
|
||||||
val text = lastRegister.text
|
val text = lastRegister.text
|
||||||
assertNotNull<Any>(text)
|
assertNotNull<Any>(text)
|
||||||
@ -340,7 +350,10 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
configureByText(before)
|
configureByText(before)
|
||||||
typeText(commandToKeys("d"))
|
typeText(commandToKeys("d"))
|
||||||
|
|
||||||
val lastRegister = VimPlugin.getRegister().lastRegister
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val lastRegister = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)
|
||||||
assertNotNull<Any>(lastRegister)
|
assertNotNull<Any>(lastRegister)
|
||||||
val text = lastRegister.text
|
val text = lastRegister.text
|
||||||
assertNotNull<Any>(text)
|
assertNotNull<Any>(text)
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
package org.jetbrains.plugins.ideavim.ex.implementation.commands
|
package org.jetbrains.plugins.ideavim.ex.implementation.commands
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
@ -111,7 +113,9 @@ class GotoLineCommandTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
assertState(after)
|
assertState(after)
|
||||||
|
|
||||||
val register = VimPlugin.getRegister().getRegister(':')
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val register = VimPlugin.getRegister().getRegister(vimEditor, context, ':')
|
||||||
assertNotNull(register)
|
assertNotNull(register)
|
||||||
assertEquals("3", register.text)
|
assertEquals("3", register.text)
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ package org.jetbrains.plugins.ideavim.ex.implementation.commands
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.register.Register
|
import com.maddyhome.idea.vim.register.Register
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
@ -170,7 +171,10 @@ class RegistersCommandTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clipboard registers "* "+
|
// Clipboard registers "* "+
|
||||||
injector.clipboardManager.setClipboardText("clipboard content", "clipboard content", emptyList())
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val clipboardContent = injector.clipboardManager.dumbCopiedText("clipboard content")
|
||||||
|
injector.clipboardManager.setClipboardContent(vimEditor, context, clipboardContent)
|
||||||
|
|
||||||
// Last search register "/
|
// Last search register "/
|
||||||
enterSearch("search pattern")
|
enterSearch("search pattern")
|
||||||
@ -235,8 +239,11 @@ class RegistersCommandTest : VimTestCase() {
|
|||||||
fun `test clipboard registers are not duplicated`() {
|
fun `test clipboard registers are not duplicated`() {
|
||||||
configureByText("<caret>line 0 ")
|
configureByText("<caret>line 0 ")
|
||||||
|
|
||||||
injector.registerGroup.saveRegister('+', Register('+', injector.clipboardManager.dumbCopiedText("Lorem ipsum dolor"), SelectionType.LINE_WISE))
|
val vimEditor = fixture.editor.vim
|
||||||
injector.clipboardManager.setClipboardText("clipboard content", "clipboard content", emptyList())
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.saveRegister(vimEditor, context, '+', Register('+', injector.clipboardManager.dumbCopiedText("Lorem ipsum dolor"), SelectionType.LINE_WISE))
|
||||||
|
val clipboardContent = injector.clipboardManager.dumbCopiedText("clipboard content")
|
||||||
|
injector.clipboardManager.setClipboardContent(vimEditor, context, clipboardContent)
|
||||||
typeText("V<Esc>")
|
typeText("V<Esc>")
|
||||||
|
|
||||||
enterCommand("registers")
|
enterCommand("registers")
|
||||||
@ -368,7 +375,10 @@ class RegistersCommandTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clipboard registers "* "+
|
// Clipboard registers "* "+
|
||||||
injector.clipboardManager.setClipboardText("clipboard content", "clipboard content", emptyList())
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val clipboardContent = injector.clipboardManager.dumbCopiedText("clipboard content")
|
||||||
|
injector.clipboardManager.setClipboardContent(vimEditor, context, clipboardContent)
|
||||||
|
|
||||||
// Last search register "/
|
// Last search register "/
|
||||||
enterSearch("search pattern")
|
enterSearch("search pattern")
|
||||||
@ -435,8 +445,11 @@ class RegistersCommandTest : VimTestCase() {
|
|||||||
fun `test clipboard registers are not duplicated linux`() {
|
fun `test clipboard registers are not duplicated linux`() {
|
||||||
configureByText("<caret>line 0 ")
|
configureByText("<caret>line 0 ")
|
||||||
|
|
||||||
injector.registerGroup.saveRegister('+', Register('+', injector.clipboardManager.dumbCopiedText("Lorem ipsum dolor"), SelectionType.LINE_WISE))
|
val vimEditor = fixture.editor.vim
|
||||||
injector.clipboardManager.setClipboardText("clipboard content", "clipboard content", emptyList())
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val clipboardContent = injector.clipboardManager.dumbCopiedText("clipboard content")
|
||||||
|
injector.registerGroup.saveRegister(vimEditor, context, '+', Register('+', injector.clipboardManager.dumbCopiedText("Lorem ipsum dolor"), SelectionType.LINE_WISE))
|
||||||
|
injector.clipboardManager.setClipboardContent(vimEditor, context, clipboardContent)
|
||||||
typeText("V<Esc>")
|
typeText("V<Esc>")
|
||||||
|
|
||||||
enterCommand("registers")
|
enterCommand("registers")
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.ex.implementation.commands
|
package org.jetbrains.plugins.ideavim.ex.implementation.commands
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.register.RegisterConstants
|
import com.maddyhome.idea.vim.register.RegisterConstants
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
@ -113,7 +113,10 @@ class YankLinesCommandTest : VimTestCase() {
|
|||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
)
|
)
|
||||||
typeText(commandToKeys("%y"))
|
typeText(commandToKeys("%y"))
|
||||||
val yanked = VimPlugin.getRegister().lastRegister!!.text
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
val yanked = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"""
|
"""
|
||||||
Lorem Ipsum
|
Lorem Ipsum
|
||||||
@ -317,19 +320,21 @@ class YankLinesCommandTest : VimTestCase() {
|
|||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
)
|
)
|
||||||
enterCommand("y")
|
enterCommand("y")
|
||||||
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
val carets = fixture.editor.vim.carets()
|
val carets = fixture.editor.vim.carets()
|
||||||
assertEquals(3, carets.size)
|
assertEquals(3, carets.size)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"Morbi nec luctus tortor, id venenatis lacus.\n",
|
"Morbi nec luctus tortor, id venenatis lacus.\n",
|
||||||
carets[0].registerStorage.getRegister(RegisterConstants.UNNAMED_REGISTER)?.text
|
carets[0].registerStorage.getRegister(vimEditor, context, RegisterConstants.UNNAMED_REGISTER)?.text
|
||||||
)
|
)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"Nunc sit amet tellus vel purus cursus posuere et at purus.\n",
|
"Nunc sit amet tellus vel purus cursus posuere et at purus.\n",
|
||||||
carets[1].registerStorage.getRegister(RegisterConstants.UNNAMED_REGISTER)?.text
|
carets[1].registerStorage.getRegister(vimEditor, context, RegisterConstants.UNNAMED_REGISTER)?.text
|
||||||
)
|
)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"Ut id dapibus augue.\n",
|
"Ut id dapibus augue.\n",
|
||||||
carets[2].registerStorage.getRegister(RegisterConstants.UNNAMED_REGISTER)?.text
|
carets[2].registerStorage.getRegister(vimEditor, context, RegisterConstants.UNNAMED_REGISTER)?.text
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,11 +49,13 @@ class ReplaceWithRegisterTest : VimTestCase() {
|
|||||||
|
|
||||||
configureByText(text)
|
configureByText(text)
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), text rangeOf "one", SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, vimEditor.primaryCaret(), text rangeOf "one", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("griw"))
|
typeText(injector.parser.parseKeys("griw"))
|
||||||
assertState("one on${c}e three")
|
assertState("one on${c}e three")
|
||||||
assertEquals("one", VimPlugin.getRegister().lastRegister?.text)
|
val registerService = injector.registerGroup
|
||||||
|
assertEquals("one", registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -79,24 +81,30 @@ class ReplaceWithRegisterTest : VimTestCase() {
|
|||||||
@Test
|
@Test
|
||||||
fun `test replace use different register`() {
|
fun `test replace use different register`() {
|
||||||
val text = "one ${c}two three four"
|
val text = "one ${c}two three four"
|
||||||
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
configureByText(text)
|
configureByText(text)
|
||||||
typeText(injector.parser.parseKeys("\"ayiw" + "w" + "\"agriw"))
|
typeText(injector.parser.parseKeys("\"ayiw" + "w" + "\"agriw"))
|
||||||
assertState("one two tw${c}o four")
|
assertState("one two tw${c}o four")
|
||||||
assertEquals("two", VimPlugin.getRegister().lastRegister?.text)
|
assertEquals("two", registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
|
||||||
typeText(injector.parser.parseKeys("w" + "griw"))
|
typeText(injector.parser.parseKeys("w" + "griw"))
|
||||||
assertState("one two two tw${c}o")
|
assertState("one two two tw${c}o")
|
||||||
assertEquals("two", VimPlugin.getRegister().lastRegister?.text)
|
assertEquals("two", registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test replace use clipboard register`() {
|
fun `test replace use clipboard register`() {
|
||||||
val text = "one ${c}two three four"
|
val text = "one ${c}two three four"
|
||||||
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
|
|
||||||
configureByText(text)
|
configureByText(text)
|
||||||
typeText(injector.parser.parseKeys("\"+yiw" + "w" + "\"+griw" + "w" + "\"+griw"))
|
typeText(injector.parser.parseKeys("\"+yiw" + "w" + "\"+griw" + "w" + "\"+griw"))
|
||||||
assertState("one two two tw${c}o")
|
assertState("one two two tw${c}o")
|
||||||
assertEquals("two", VimPlugin.getRegister().lastRegister?.text)
|
assertEquals("two", registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -169,11 +177,13 @@ class ReplaceWithRegisterTest : VimTestCase() {
|
|||||||
|
|
||||||
configureByText(text)
|
configureByText(text)
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), text rangeOf "one", SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, vimEditor.primaryCaret(), text rangeOf "one", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("3griw"))
|
typeText(injector.parser.parseKeys("3griw"))
|
||||||
assertState("one on${c}e four")
|
assertState("one on${c}e four")
|
||||||
assertEquals("one", VimPlugin.getRegister().lastRegister?.text)
|
assertEquals("one", registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
@VimBehaviorDiffers("one on${c}e on${c}e four")
|
@VimBehaviorDiffers("one on${c}e on${c}e four")
|
||||||
@ -183,11 +193,13 @@ class ReplaceWithRegisterTest : VimTestCase() {
|
|||||||
|
|
||||||
configureByText(text)
|
configureByText(text)
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), text rangeOf "one", SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, vimEditor.primaryCaret(), text rangeOf "one", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("griw"))
|
typeText(injector.parser.parseKeys("griw"))
|
||||||
assertState("one two one four")
|
assertState("one two one four")
|
||||||
assertEquals("one", VimPlugin.getRegister().lastRegister?.text)
|
assertEquals("one", registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -196,11 +208,13 @@ class ReplaceWithRegisterTest : VimTestCase() {
|
|||||||
|
|
||||||
configureByText(text)
|
configureByText(text)
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), text rangeOf "one", SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, vimEditor.primaryCaret(), text rangeOf "one", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("griw" + "w" + "."))
|
typeText(injector.parser.parseKeys("griw" + "w" + "."))
|
||||||
assertState("one one on${c}e four")
|
assertState("one one on${c}e four")
|
||||||
assertEquals("one", VimPlugin.getRegister().lastRegister?.text)
|
assertEquals("one", registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -246,8 +260,10 @@ class ReplaceWithRegisterTest : VimTestCase() {
|
|||||||
|
|
||||||
configureByText(text)
|
configureByText(text)
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), text rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, vimEditor.primaryCaret(), text rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("grr"))
|
typeText(injector.parser.parseKeys("grr"))
|
||||||
assertState(
|
assertState(
|
||||||
"""
|
"""
|
||||||
@ -257,7 +273,7 @@ class ReplaceWithRegisterTest : VimTestCase() {
|
|||||||
Cras id tellus in ex imperdiet egestas.
|
Cras id tellus in ex imperdiet egestas.
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
)
|
)
|
||||||
assertEquals("legendary", VimPlugin.getRegister().lastRegister?.text)
|
assertEquals("legendary", registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -413,8 +429,10 @@ class ReplaceWithRegisterTest : VimTestCase() {
|
|||||||
|
|
||||||
configureByText(text)
|
configureByText(text)
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val registerService = injector.registerGroup
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), text rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, vimEditor.primaryCaret(), text rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("viw" + "gr"))
|
typeText(injector.parser.parseKeys("viw" + "gr"))
|
||||||
assertState(
|
assertState(
|
||||||
"""
|
"""
|
||||||
@ -424,7 +442,7 @@ class ReplaceWithRegisterTest : VimTestCase() {
|
|||||||
Cras id tellus in ex imperdiet egestas.
|
Cras id tellus in ex imperdiet egestas.
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
)
|
)
|
||||||
assertEquals("legendary", VimPlugin.getRegister().lastRegister?.text)
|
assertEquals("legendary", registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text)
|
||||||
assertMode(Mode.NORMAL())
|
assertMode(Mode.NORMAL())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,8 +502,9 @@ class ReplaceWithRegisterTest : VimTestCase() {
|
|||||||
|
|
||||||
configureByText(text)
|
configureByText(text)
|
||||||
val vimEditor = fixture.editor.vim
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
VimPlugin.getRegister()
|
VimPlugin.getRegister()
|
||||||
.storeText(vimEditor, vimEditor.primaryCaret(), text rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
.storeText(vimEditor, context, vimEditor.primaryCaret(), text rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||||
typeText(injector.parser.parseKeys("V" + "gr"))
|
typeText(injector.parser.parseKeys("V" + "gr"))
|
||||||
assertState(
|
assertState(
|
||||||
"""
|
"""
|
||||||
@ -585,8 +604,10 @@ class ReplaceWithRegisterTest : VimTestCase() {
|
|||||||
VimPlugin.getRegister().resetRegisters()
|
VimPlugin.getRegister().resetRegisters()
|
||||||
|
|
||||||
configureByText("one ${c}two three")
|
configureByText("one ${c}two three")
|
||||||
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
enterCommand("set clipboard+=unnamed")
|
enterCommand("set clipboard+=unnamed")
|
||||||
injector.registerGroup.storeText('*', "four")
|
injector.registerGroup.storeText(vimEditor, context, '*', "four")
|
||||||
|
|
||||||
typeText(injector.parser.parseKeys("vegr"))
|
typeText(injector.parser.parseKeys("vegr"))
|
||||||
assertState("one two three")
|
assertState("one two three")
|
||||||
|
@ -15,6 +15,7 @@ import com.ensarsarajcic.neovim.java.corerpc.client.ProcessRpcConnection
|
|||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.LogicalPosition
|
import com.intellij.openapi.editor.LogicalPosition
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.common.CharacterPosition
|
import com.maddyhome.idea.vim.common.CharacterPosition
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.register.RegisterConstants.ALTERNATE_BUFFER_REGISTER
|
import com.maddyhome.idea.vim.register.RegisterConstants.ALTERNATE_BUFFER_REGISTER
|
||||||
@ -137,7 +138,7 @@ object NeovimTesting {
|
|||||||
assertText(editor)
|
assertText(editor)
|
||||||
assertCaret(editor, test)
|
assertCaret(editor, test)
|
||||||
assertMode(editor)
|
assertMode(editor)
|
||||||
assertRegisters()
|
assertRegisters(editor)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setRegister(register: Char, keys: String, test: TestInfo) {
|
fun setRegister(register: Char, keys: String, test: TestInfo) {
|
||||||
@ -181,12 +182,14 @@ object NeovimTesting {
|
|||||||
EXPRESSION_BUFFER_REGISTER +
|
EXPRESSION_BUFFER_REGISTER +
|
||||||
CURRENT_FILENAME_REGISTER
|
CURRENT_FILENAME_REGISTER
|
||||||
|
|
||||||
private fun assertRegisters() {
|
private fun assertRegisters(editor: Editor) {
|
||||||
for (register in VALID_REGISTERS) {
|
for (register in VALID_REGISTERS) {
|
||||||
if (register in nonCheckingRegisters) continue
|
if (register in nonCheckingRegisters) continue
|
||||||
if (register in VimTestCase.Checks.neoVim.ignoredRegisters) continue
|
if (register in VimTestCase.Checks.neoVim.ignoredRegisters) continue
|
||||||
val neovimRegister = getRegister(register)
|
val neovimRegister = getRegister(register)
|
||||||
val vimPluginRegister = VimPlugin.getRegister().getRegister(register)
|
val vimEditor = editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val vimPluginRegister = VimPlugin.getRegister().getRegister(vimEditor, context, register)
|
||||||
val ideavimRegister = vimPluginRegister?.text ?: ""
|
val ideavimRegister = vimPluginRegister?.text ?: ""
|
||||||
assertEquals(neovimRegister, ideavimRegister, "Register '$register'")
|
assertEquals(neovimRegister, ideavimRegister, "Register '$register'")
|
||||||
|
|
||||||
|
@ -552,15 +552,19 @@ abstract class VimNoWriteActionTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun assertRegister(char: Char, expected: String?) {
|
protected fun assertRegister(char: Char, expected: String?) {
|
||||||
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
if (expected == null) {
|
if (expected == null) {
|
||||||
assertNull(injector.registerGroup.getRegister(char))
|
assertNull(injector.registerGroup.getRegister(vimEditor, context, char))
|
||||||
} else {
|
} else {
|
||||||
assertEquals(expected, injector.registerGroup.getRegister(char)?.printableString)
|
assertEquals(expected, injector.registerGroup.getRegister(vimEditor, context, char)?.printableString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun assertRegisterString(char: Char, expected: String?) {
|
protected fun assertRegisterString(char: Char, expected: String?) {
|
||||||
val actual = injector.registerGroup.getRegister(char)?.keys?.let(injector.parser::toPrintableString)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
val actual = injector.registerGroup.getRegister(vimEditor, context, char)?.keys?.let(injector.parser::toPrintableString)
|
||||||
assertEquals(expected, actual, "Wrong register contents")
|
assertEquals(expected, actual, "Wrong register contents")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action
|
package org.jetbrains.plugins.ideavim.action
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.VimJavaTestCase
|
import org.jetbrains.plugins.ideavim.VimJavaTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
@ -198,7 +199,9 @@ y = true; // And this will not
|
|||||||
${c}private int myK = 0;
|
${c}private int myK = 0;
|
||||||
}"""
|
}"""
|
||||||
configureByJavaText(before)
|
configureByJavaText(before)
|
||||||
injector.registerGroup.storeText('*', "private int myK = 0;\n", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "private int myK = 0;\n", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*P"))
|
typeText(injector.parser.parseKeys("\"*P"))
|
||||||
val after = """class C {
|
val after = """class C {
|
||||||
C(int i) {
|
C(int i) {
|
||||||
@ -229,7 +232,9 @@ y = true; // And this will not
|
|||||||
${c}private int myK = 0;
|
${c}private int myK = 0;
|
||||||
}"""
|
}"""
|
||||||
configureByJavaText(before)
|
configureByJavaText(before)
|
||||||
injector.registerGroup.storeText('*', "private int myK = 0;", SelectionType.LINE_WISE)
|
val vimEditor = fixture.editor.vim
|
||||||
|
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||||
|
injector.registerGroup.storeText(vimEditor, context, '*', "private int myK = 0;", SelectionType.LINE_WISE)
|
||||||
typeText(injector.parser.parseKeys("\"*p"))
|
typeText(injector.parser.parseKeys("\"*p"))
|
||||||
val after = """class C {
|
val after = """class C {
|
||||||
C(int i) {
|
C(int i) {
|
||||||
|
@ -37,7 +37,7 @@ abstract class VimMacroBase : VimMacro {
|
|||||||
*/
|
*/
|
||||||
override fun playbackRegister(editor: VimEditor, context: ExecutionContext, reg: Char, count: Int): Boolean {
|
override fun playbackRegister(editor: VimEditor, context: ExecutionContext, reg: Char, count: Int): Boolean {
|
||||||
logger.debug { "play back register $reg $count times" }
|
logger.debug { "play back register $reg $count times" }
|
||||||
val register = injector.registerGroup.getPlaybackRegister(reg) ?: return false
|
val register = injector.registerGroup.getPlaybackRegister(editor, context, reg) ?: return false
|
||||||
++macroDepth
|
++macroDepth
|
||||||
try {
|
try {
|
||||||
logger.trace {
|
logger.trace {
|
||||||
|
@ -57,7 +57,7 @@ data class RepeatCommand(val range: Range, val modifier: CommandModifier, val ar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val reg = injector.registerGroup.getPlaybackRegister(arg) ?: return ExecutionResult.Error
|
val reg = injector.registerGroup.getPlaybackRegister(editor, context, arg) ?: return ExecutionResult.Error
|
||||||
val text = reg.text ?: return ExecutionResult.Error
|
val text = reg.text ?: return ExecutionResult.Error
|
||||||
|
|
||||||
injector.vimscriptExecutor.execute(
|
injector.vimscriptExecutor.execute(
|
||||||
|
Loading…
Reference in New Issue
Block a user