-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
TextEditor.selection is not respected in clipboard operations #6994
Comments
@alefragnani It's not really an API command - the behaviour isn't spec'd. For now I'd recommend to use a node_module to copy stuff to clipboard |
@jrieken I understand that. I just reported the issue because in #4393 it was considered a bug, and was fixed by this commit. I will move to https://github.com/xavi-/node-copy-paste, as you suggested in some other issues, like #4972 and #217. Thanks |
@alexandrudima Can you comment? |
Sorry for not noticing this comment, I tried the following and it works for me: commands.registerCommand('test', () => {
let editor = window.activeTextEditor;
let doc = editor.document;
let selection = editor.selection;
const cursorWordRange = doc.getWordRangeAtPosition(selection.active);
var newSe = new Selection(cursorWordRange.start.line, cursorWordRange.start.character, cursorWordRange.end.line, cursorWordRange.end.character);
editor.selection = newSe;
commands.executeCommand("editor.action.clipboardCutAction");
}); |
No problem @alexandrudima 👍 I followed @jrieken suggestion and since then, I'm using https://github.com/xavi-/node-copy-paste, instead of the clipboard Thanks |
Addressing hiro-sun#4 and hiro-sun#38 Removed the kill ring implementation (which was not on parity with emacs anyway). The cut/paste/copy commands now only deal with the system clipboard, no separate kill ring. Using the copy-paste module for handling the clipboard, as recommended in multiple issues on vscode repo (microsoft/vscode#6994 and various others).
Steps to Reproduce:
TextEditor.selection
editor.action.clipboardCopyAction
oreditor.action.clipboardCutAction
commandsThe code is basically this one:
The issue already appeared in version 0.10.11 and was fixed in March release (#4393), but returned 1.1.0.
Thanks in advance
The text was updated successfully, but these errors were encountered: