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

Fix for #2414 - truncated copy/paste #2515

Merged
merged 8 commits into from
Aug 27, 2018
Merged

Fix for #2414 - truncated copy/paste #2515

merged 8 commits into from
Aug 27, 2018

Conversation

psxpaul
Copy link
Contributor

@psxpaul psxpaul commented Aug 20, 2018

This is a fix for some of the issues raised in #2414. One thing to note - there was some question as to whether win32yank works for everyone. I did find a possible workaround for that, if it's still an issue:

const textToPaste = clipboard.readText()
const sanitizedTextLines = replaceAll(textToPaste, { "'": "''" })
await neovimInstance.command("let @+='" + sanitizedTextLines + "'")

I don't have a windows box to test this on, so perhaps we can add this code to NeovimEditorCommands. pasteContents later if needed.

@@ -79,6 +80,7 @@ export const applyDefaultKeyBindings = (oni: Oni.Plugin.Api, config: Configurati
input.bind("<c-,>", "oni.config.openConfigJs")

if (config.getValue("editor.clipboard.enabled")) {
input.bind("<c-x>", "editor.clipboard.cut", isVisualMode)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<c-x> in visual mode decrements an integer value under the cursor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up, I'll remove this part

@codecov
Copy link

codecov bot commented Aug 20, 2018

Codecov Report

Merging #2515 into master will decrease coverage by 0.02%.
The diff coverage is 6.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2515      +/-   ##
==========================================
- Coverage    43.6%   43.57%   -0.03%     
==========================================
  Files         351      351              
  Lines       14176    14186      +10     
  Branches     1845     1846       +1     
==========================================
+ Hits         6181     6182       +1     
- Misses       7758     7767       +9     
  Partials      237      237
Impacted Files Coverage Δ
...er/src/Editor/NeovimEditor/NeovimEditorCommands.ts 11.94% <6.66%> (-0.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e3f65e6...eb48006. Read the comment docs.

@CrossR
Copy link
Member

CrossR commented Aug 21, 2018

I can give this a test on a clean Windows VM to check if a base config works with this new method. That way, if people have an issue with win32yank, its most likely their config.

@akinsho
Copy link
Member

akinsho commented Aug 23, 2018

@psxpaul seems the large paste test is repeatedly failing on windows 😭 we might need the solution in the snippet you pasted for windows

@CrossR
Copy link
Member

CrossR commented Aug 23, 2018

I've not had a chance to test this yet, but I've set a reminder to do it tonight, so should be able to test it then. I'll also give it a test on my normal dev box, see if its all Windows or just the CI / base config versions of Oni.

@CrossR
Copy link
Member

CrossR commented Aug 23, 2018

This is pretty odd....I ran the CI tests locally, it passed fine twice. I started Oni, pasted and copied a bunch, all good.

Then I tried it one last time, and now there is no clipboard provider registered, :checkhealth says its not hooked up...

Even weirder, I reloaded Oni (Ctrl-Shift-P -> Reload) and :checkhealth was fine. Reloaded again, was bad. One last reload....everything fine again.

@psxpaul
Copy link
Contributor Author

psxpaul commented Aug 26, 2018

Thanks for trying it out @CrossR. I got a Windows VM setup and managed to get the win32yank workaround working. I wasn't sure if this workaround should only be applied for windows machines, but the approach seems to work fine on my Mac and Linux machines.

Copy link
Member

@akinsho akinsho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psxpaul thanks for all the work on this 👍, glad its working crossplatform now

@akinsho akinsho merged commit e482ae8 into onivim:master Aug 27, 2018
@josemarluedke
Copy link
Contributor

josemarluedke commented Aug 28, 2018

This PR might hame created a issue when pasting on command. Say I start a search with / and paste using cmd + v. The content will actually be pasted under the buffer that was focused instead of putting that content on the search.

akinsho pushed a commit that referenced this pull request Aug 29, 2018
As @josemarluedke mentioned [here](#2515 (comment)), pasting in command line mode was broken with #2515.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants