Skip to content

Commit

Permalink
fixes #1180 (#1183)
Browse files Browse the repository at this point in the history
  • Loading branch information
xconverge authored and johnfn committed Dec 21, 2016
1 parent ac87146 commit 0462e79
Showing 1 changed file with 14 additions and 8 deletions.
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

0 comments on commit 0462e79

Please sign in to comment.