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

Fix bug when pasting in command line mode #2528

Merged
merged 1 commit into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion browser/src/Editor/NeovimEditor/NeovimEditorCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ export class NeovimEditorCommands {
await neovimInstance.command('let b:oniclipboard=@"')
await neovimInstance.command(`let @"='${sanitizedTextLines}'`)

if (editorManager.activeEditor.mode === "insert") {
if (
editorManager.activeEditor.mode === "insert" ||
editorManager.activeEditor.mode === "cmdline_normal"
) {
await neovimInstance.command("set paste")
await neovimInstance.input('<c-r>"')
await neovimInstance.command("set nopaste")
Expand Down
16 changes: 14 additions & 2 deletions test/ci/LargePasteTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
*/
import * as assert from "assert"
import * as Oni from "oni-api"

import { createNewFile, getTemporaryFilePath, navigateToFile } from "./Common"
import {
createNewFile,
getElementByClassName,
getTemporaryFilePath,
navigateToFile,
} from "./Common"

export const test = async (oni: Oni.Plugin.Api) => {
const filePath = createLargeTestFile()
Expand Down Expand Up @@ -49,6 +53,14 @@ export const test = async (oni: Oni.Plugin.Api) => {
firstLine,
"thithiss is a line of 'text' that will be repeated a bunch of times to make for a large wall of 'text' to paste",
)

// type ':' and paste the text into the command line
oni.automation.sendKeys(":")
await oni.automation.waitFor(() => oni.editors.activeEditor.mode === "cmdline_normal")
await paste(oni, () => {
const commandLine = getElementByClassName("command-line")
return commandLine && commandLine.textContent === ":this"
})
}

import * as fs from "fs"
Expand Down