-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Conversation
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidental diff?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
87c1b0f
to
a224acb
Compare
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. |
@Tyriar feel free to test |
There was a problem hiding this 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 👍
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.