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

Allow right-click paste (again) #293

Merged
merged 4 commits into from
Oct 1, 2016
Merged

Allow right-click paste (again) #293

merged 4 commits into from
Oct 1, 2016

Conversation

parisk
Copy link
Contributor

@parisk parisk commented Sep 28, 2016

Allow right-click paste in the terminal, with the hidden textarea.

For the purposes of this PR, I branched out all clipboard logic into a new module and documented everything with JSDoc.

This PR closes #202 and renders #232 useless for the moment.

@@ -1691,15 +1650,15 @@ Terminal.prototype.write = function(data) {
case '=':
this.log('Serial port requested application keypad.');
this.applicationKeypad = true;
this.viewport.syncScrollArea();
this.viewport.setApplicationMode(true);
Copy link
Member

Choose a reason for hiding this comment

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

Accidental diff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wow. I have no idea how this appeared here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rewrote history, so this is gone now. Thanks for pointing out!

on(this.textarea, 'paste', function (ev) {
pasteHandler.call(this, ev, term);
});
on(this.element, 'contextmenu', function (ev) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this might conflict with vscode which overrides the context menu to show options to create new terminal, paste and copy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you sure? I am not cancelling the event.

Copy link
Member

Choose a reason for hiding this comment

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

@parisk wouldn't it cause 2 context menus to appear or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. All I am doing here is move the textarea when the context menu appears. Is there any easy way to try this out?

return term.cancel(ev);
}
// Bind clipboard functionality
on(this.element, 'copy', copyHandler);
Copy link
Member

Choose a reason for hiding this comment

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

Should copy be exposed via the API so it can be done programmatically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All methods are already exposed in Clipboard.js. This also would not work in browsers, so I am skeptical about exposing such a public API.

@parisk parisk force-pushed the issue-#202-fix-paste branch from 87c1b0f to a224acb Compare September 29, 2016 07:53
@Tyriar
Copy link
Member

Tyriar commented Sep 29, 2016

Let me know when this is good to go and I'll do a quick test with vscode, I suspect there might be some breakages for Electron apps with custom right click menus.

@parisk
Copy link
Contributor Author

parisk commented Sep 29, 2016

@Tyriar feel free to test

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

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

Seems to work fine 👍

@parisk parisk merged commit 9115846 into master Oct 1, 2016
@Tyriar Tyriar deleted the issue-#202-fix-paste branch October 31, 2016 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Right-click paste does not work
2 participants