-
Notifications
You must be signed in to change notification settings - Fork 1.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
Normalize line endings on paste #659
Conversation
@Tyriar This the PR I mentioned in our email exchange earlier :) |
src/handlers/Clipboard.ts
Outdated
@@ -68,6 +76,7 @@ export function pasteHandler(ev: ClipboardEvent, term: ITerminal) { | |||
let text: string; | |||
|
|||
let dispatchPaste = function(text) { | |||
text = prepareTextForTerminal(text); |
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 we should probably apply this only on Windows:
import { isMSWindows } from './Browser';
...
if (isMSWindows) {
...
}
Thoughts @jdanyow?
I created an issue for tracking and amended the top comment so it will close off automatically 😃 |
* Prepares text to be pasted into the terminal by normalizing the line endings | ||
* @param text The pasted text that needs processing before inserting into the terminal | ||
*/ | ||
export function prepareTextForTerminal(text: string, isMSWindows: boolean): string { |
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.
this signature made the tests easy to implement- let me know if you'd rather see this rolled into dispatchPaste or some other form
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.
Easy tests are good 👌
@parisk coveralls doesn't seem to be completing, the build seems to have completed successfully though https://travis-ci.org/sourcelair/xterm.js/jobs/230548323 |
Seems to be OK now 😄 . |
I'm seeing some weird behavior after this. See #683 |
Enables pasting multi-line text into the terminal.
cc @EisenbergEffect, @yangl900, @DuncanmaMSFT
Fixes #660