Browse Source

Resolves #436 - Copy to clipboard not working

main
Eric Amodio 6 years ago
parent
commit
f47a92e324
3 changed files with 19 additions and 5 deletions
  1. +3
    -0
      CHANGELOG.md
  2. +8
    -3
      src/commands/copyMessageToClipboard.ts
  3. +8
    -2
      src/commands/copyShaToClipboard.ts

+ 3
- 0
CHANGELOG.md View File

@ -9,6 +9,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds `gitlens.hovers.avatars` setting to specify whether to show avatar images in hovers — closes [#432](https://github.com/eamodio/vscode-gitlens/issues/432) thanks to [PR #441](https://github.com/eamodio/vscode-gitlens/pull/441) by Segev Finer ([@segevfiner](https://github.com/segevfiner))
- Adds `gitlens.hovers.avatars` setting to the interactive settings editor to specify whether to show avatar images in hovers
### Fixed
- Fixes [#436](https://github.com/eamodio/vscode-gitlens/issues/436) - Copy to clipboard not working
## [8.4.1] - 2018-06-19
### Fixed
- Fixes issue with insiders builds because of the new `SymbolInformation` API changes (see [Microsoft/vscode#34968](https://github.com/Microsoft/vscode/issues/34968))

+ 8
- 3
src/commands/copyMessageToClipboard.ts View File

@ -30,9 +30,9 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
async execute(editor?: TextEditor, uri?: Uri, args: CopyMessageToClipboardCommandArgs = {}): Promise<any> {
uri = getCommandUri(uri, editor);
const clipboard = await import('clipboardy');
try {
const clipboard = await import('clipboardy');
args = { ...args };
// If we don't have an editor then get the message of the last commit to the branch
@ -78,10 +78,15 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
args.message = commit.message;
}
clipboard.write(args.message);
void await clipboard.write(args.message);
return undefined;
}
catch (ex) {
if (ex.message.includes('Couldn\'t find the required `xsel` binary')) {
window.showErrorMessage(`Unable to copy message, xsel is not installed. You can install it via \`sudo apt install xsel\``);
return;
}
Logger.error(ex, 'CopyMessageToClipboardCommand');
return window.showErrorMessage(`Unable to copy message. See output channel for more details`);
}

+ 8
- 2
src/commands/copyShaToClipboard.ts View File

@ -29,8 +29,9 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand {
async execute(editor?: TextEditor, uri?: Uri, args: CopyShaToClipboardCommandArgs = {}): Promise<any> {
uri = getCommandUri(uri, editor);
const clipboard = await import('clipboardy');
try {
const clipboard = await import('clipboardy');
args = { ...args };
// If we don't have an editor then get the sha of the last commit to the branch
@ -62,10 +63,15 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand {
}
}
clipboard.write(args.sha);
void await clipboard.write(args.sha);
return undefined;
}
catch (ex) {
if (ex.message.includes('Couldn\'t find the required `xsel` binary')) {
window.showErrorMessage(`Unable to copy commit id, xsel is not installed. You can install it via \`sudo apt install xsel\``);
return;
}
Logger.error(ex, 'CopyShaToClipboardCommand');
return window.showErrorMessage(`Unable to copy commit id. See output channel for more details`);
}

||||||
x
 
000:0
Loading…
Cancel
Save