Skip to content
This repository was archived by the owner on Apr 1, 2020. It is now read-only.

Commit 4ce6b22

Browse files
psxpaulakinsho
authored andcommitted
Fix bug when pasting in command line mode (#2528)
As @josemarluedke mentioned [here](#2515 (comment)), pasting in command line mode was broken with #2515.
1 parent e612eb8 commit 4ce6b22

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

browser/src/Editor/NeovimEditor/NeovimEditorCommands.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ export class NeovimEditorCommands {
7474
await neovimInstance.command('let b:oniclipboard=@"')
7575
await neovimInstance.command(`let @"='${sanitizedTextLines}'`)
7676

77-
if (editorManager.activeEditor.mode === "insert") {
77+
if (
78+
editorManager.activeEditor.mode === "insert" ||
79+
editorManager.activeEditor.mode === "cmdline_normal"
80+
) {
7881
await neovimInstance.command("set paste")
7982
await neovimInstance.input('<c-r>"')
8083
await neovimInstance.command("set nopaste")

test/ci/LargePasteTest.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
*/
66
import * as assert from "assert"
77
import * as Oni from "oni-api"
8-
9-
import { createNewFile, getTemporaryFilePath, navigateToFile } from "./Common"
8+
import {
9+
createNewFile,
10+
getElementByClassName,
11+
getTemporaryFilePath,
12+
navigateToFile,
13+
} from "./Common"
1014

1115
export const test = async (oni: Oni.Plugin.Api) => {
1216
const filePath = createLargeTestFile()
@@ -49,6 +53,14 @@ export const test = async (oni: Oni.Plugin.Api) => {
4953
firstLine,
5054
"thithiss is a line of 'text' that will be repeated a bunch of times to make for a large wall of 'text' to paste",
5155
)
56+
57+
// type ':' and paste the text into the command line
58+
oni.automation.sendKeys(":")
59+
await oni.automation.waitFor(() => oni.editors.activeEditor.mode === "cmdline_normal")
60+
await paste(oni, () => {
61+
const commandLine = getElementByClassName("command-line")
62+
return commandLine && commandLine.textContent === ":this"
63+
})
5264
}
5365

5466
import * as fs from "fs"

0 commit comments

Comments
 (0)