Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #1180 #1183

Merged
merged 1 commit into from
Dec 21, 2016
Merged
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
22 changes: 14 additions & 8 deletions src/register/register.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { VimState, RecordedState } from './../mode/modeHandler';
import * as clipboard from 'copy-paste';
import { YankOperator, BaseOperator, CommandRegister, DeleteOperator } from './../actions/actions';
import * as vscode from "vscode";

/**
* There are two different modes of copy/paste in Vim - copy by character
Expand Down Expand Up @@ -191,16 +192,20 @@ export class Register {
*/
private static putNormalRegister(content: RegisterContent, register: string, vimState: VimState): void {
if (Register.isClipboardRegister(register)) {
clipboard.copy(content);
}
clipboard.copy(content, (err) => {
if (err) {
vscode.window.showErrorMessage("Error yanking, if useSystemClipboard is true and you are using Linux, please install xclip.");
}
});

Register.registers[register.toLowerCase()] = {
text : content,
registerMode : vimState.effectiveRegisterMode(),
isClipboardRegister: Register.isClipboardRegister(register),
};
Register.registers[register.toLowerCase()] = {
text: content,
registerMode: vimState.effectiveRegisterMode(),
isClipboardRegister: Register.isClipboardRegister(register),
};

Register.ProcessNumberedRegister(content, vimState);
Register.ProcessNumberedRegister(content, vimState);
}
}

/**
Expand Down Expand Up @@ -313,6 +318,7 @@ export class Register {
let text = await new Promise<string>((resolve, reject) =>
clipboard.paste((err, text) => {
if (err) {
vscode.window.showErrorMessage("Error pasting, if useSystemClipboard is true and you are using Linux, please install xclip.");
reject(err);
} else {
resolve(text);
Expand Down