Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Conversation

@winstliu
Copy link
Contributor

@winstliu winstliu commented Mar 20, 2019

Requirements for Adding, Changing, or Removing a Feature

Issue or RFC Endorsed by Atom's Maintainers

#8365, endorsed by @maxbrunsfeld here.

Description of the Change

Whenever text is copied to the clipboard, all line endings are converted to the underlying OS's default line endings (CRLF on Windows, LF otherwise). Fixes #8365.

Alternate Designs

I could have done const os = require('os') and then used os.EOL instead of hardcoding the line endings in clipboard.js, but that didn't seem worth it.

This could also be implemented as a Windows-only feature, which I believe is how VSCode does it.

Possible Drawbacks

Sometimes you may want to explicitly copy the text as-is without conversions, and this will prevent that.

Verification Process

On Windows, I copied text with LF line endings and pasted them into http://www.unit-conversion.info/texttools/hexadecimal/, which confirmed that the pasted text had 0d 0a (CRLF).

Release Notes

Line endings are now converted when copy and pasting.

@winstliu
Copy link
Contributor Author

Note: this won't affect pasting in Atom that much: copying LF and pasting it into another LF file will still result in LF line endings, not CRLF.

@winstliu
Copy link
Contributor Author

Hmm, this breaks some tests. I can add a boolean option whether to do the conversion or not.

@rafeca
Copy link
Contributor

rafeca commented May 31, 2019

Hey! 👋

We have recently started using prettier and this has caused major
style changes on the Atom JS codebase (you can check the related PR).

This is good news: now the Atom code is more consistent and it's much easier to re-format the code to
follow the codestyle (now you only need to run script/lint --fix).

This change caused conflicts on your PR that we have automatically solved, hope you don't mind 😄

With ❤️, the Atom team.

@sadick254 sadick254 force-pushed the wl-clipboard-line-endings branch from 18b9657 to 72b21d1 Compare May 28, 2021 14:48
Copy link
Contributor

@sadick254 sadick254 left a comment

Choose a reason for hiding this comment

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

Hey @50Wliu, I have just resolved some conflicts on this and I think it's good to go. Thank you for your contribution.

@winstliu
Copy link
Contributor Author

winstliu commented Jun 7, 2021

@sadick254 feel free to merge, I really shouldn't have merge permissions anymore :).

@sadick254 sadick254 force-pushed the wl-clipboard-line-endings branch from 7a2ff51 to b9f6cdd Compare September 22, 2021 07:28
@sadick254 sadick254 self-assigned this Sep 22, 2021
@sadick254 sadick254 force-pushed the wl-clipboard-line-endings branch 2 times, most recently from 15914ab to c8cda7f Compare September 29, 2021 09:44
Winston Liu and others added 3 commits September 29, 2021 13:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy-paste doesn't work properly with Unix-style line endings under Windows

4 participants