mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-02-26 05:46:00 +01:00
Fix(VIM-2675): Fix numbering register in visual mode
This commit is contained in:
parent
38ed9c206a
commit
072449825c
src/test/java/org/jetbrains/plugins/ideavim/action/copy
vim-engine/src/main/kotlin/com/maddyhome/idea/vim
@ -271,6 +271,38 @@ class YankVisualActionTest : VimTestCase() {
|
||||
)
|
||||
}
|
||||
|
||||
fun `test yank to numbered register in visual`() {
|
||||
doTest(
|
||||
injector.parser.parseKeys("ve" + "\"2y"),
|
||||
"""
|
||||
A Discovery
|
||||
|
||||
I found it in a legendary land
|
||||
all ${c}rocks and lavender and tufted grass,[ additional symbols]
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent(),
|
||||
"rocks",
|
||||
SelectionType.CHARACTER_WISE
|
||||
)
|
||||
}
|
||||
|
||||
fun `test yank to numbered register`() {
|
||||
doTest(
|
||||
injector.parser.parseKeys("\"2yy"),
|
||||
"""
|
||||
A Discovery
|
||||
|
||||
I found it in a legendary land
|
||||
all ${c}rocks and lavender and tufted grass,[ additional symbols]
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent(),
|
||||
"all rocks and lavender and tufted grass,[ additional symbols]\n",
|
||||
SelectionType.LINE_WISE
|
||||
)
|
||||
}
|
||||
|
||||
private fun doTest(keys: List<KeyStroke>, before: String, expectedText: String, expectedType: SelectionType) {
|
||||
configureByText(before)
|
||||
typeText(keys)
|
||||
|
@ -496,7 +496,7 @@ class KeyHandler {
|
||||
// Make sure to avoid handling '0' as the start of a count.
|
||||
val commandBuilder = editorState.commandBuilder
|
||||
val notRegisterPendingCommand = editorState.mode.inNormalMode && !editorState.isRegisterPending
|
||||
val visualMode = editorState.mode.inVisualMode
|
||||
val visualMode = editorState.mode.inVisualMode && !editorState.isRegisterPending
|
||||
val opPendingMode = editorState.mode === CommandState.Mode.OP_PENDING
|
||||
|
||||
if (notRegisterPendingCommand || visualMode || opPendingMode) {
|
||||
|
Loading…
Reference in New Issue
Block a user