-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Convert clipboard line ending to document line ending when pasting #716
Conversation
Yeah, I think what we actually want to do here is have a stand-alone function that (probably?) takes a The non-specialized line endings are ( helix/helix-term/src/commands.rs Lines 1427 to 1435 in fe17b99
const &[] of the relevant line endings will do, so we can call contains() )
|
This prompted me to investigate the purpose of the various line endings further, which led me to this: It's actually not entirely clear to me yet which line endings should be treated as "specialized" or not. So let's definitely centralize that, and then we can adjust as needed later. (I'm suspecting that everything except |
Perhaps we could use |
for the clipboard one: // only compile the regex once
#[allow(clippy::trivial_regex)]
static REGEX: Lazy<Regex> =
Lazy::new(|| Regex::new(r"\r\n|\r|\n").unwrap());
REGEX.replace_all(paste_string, new_line_ending) |
I'd completely drop the line ending conversion from this PR and only land the clipboard change. Fixing document-wide line endings is simple to do from the terminal, we can implement a better solution later. |
Yeah, for now I think that's good. We know at least those should be replaced, and if/when I get around to more fully investigating the Unicode line ending situation I'll make a PR to include any others that should be covered as well. |
Resolves #715
WIP because it doesn't play nice with the LSP.