[PR #2009] Convert pasted line endings #24764

Closed
opened 2026-01-31 09:05:13 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/2009

State: closed
Merged: No


Summary of the Pull Request

This is from a PR request by @d-bingham. However, there have been 89 commits since then, and there are merge conflicts that have not been attended to in a month, and I think converting pasted line endings is a neat idea, so this PR has the changes in PR#1094, but rebased to be current.

References

PR#1094

PR Checklist

  • [x ] Closes Ligatures do not render under cursor column in Vim (#1091)
  • [ x] CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • [x ] Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

@d-bingham said

The new option, convertPasteLineEndings does what it says -- replacing Windows-space CRLF pairs with Unix-space LFs in text pasted to the console. This option applies to both the keyboard-shortcut paste and the right-click paste. Without this most multiline text pasted into Terminal will be "double-spaced" due to the Windows-style CRLF pairs. Furthermore, any multiline text copied from Terminal (in trim whitespace mode) generates CRLF pairs, which guarantees double-spacing when copying from a WSL Terminal session.
Changes:

  • Added TermControl::_SendPastedTextToConnection which adds a pre-processing layer on top of _SendInputToConnection to allow line-ending conversion
  • Various code in Profile/TerminalSettings to support the new option "convertPasteLineEndings" (optional, defaults to false)

Validation Steps Performed

I performed a manual test, ensuring this would not break any current code.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/2009 **State:** closed **Merged:** No --- <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request This is from a PR request by @d-bingham. However, there have been 89 commits since then, and there are merge conflicts that have not been attended to in a month, and I think converting pasted line endings is a neat idea, so this PR has the changes in PR#1094, but rebased to be current. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References PR#1094 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x ] Closes #1091 * [ x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] Tests added/passed * [x ] Requires documentation to be updated * [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments @d-bingham said > The new option, convertPasteLineEndings does what it says -- replacing Windows-space CRLF pairs with Unix-space LFs in text pasted to the console. This option applies to both the keyboard-shortcut paste and the right-click paste. Without this most multiline text pasted into Terminal will be "double-spaced" due to the Windows-style CRLF pairs. Furthermore, any multiline text copied from Terminal (in trim whitespace mode) generates CRLF pairs, which guarantees double-spacing when copying from a WSL Terminal session. Changes: > - Added TermControl::_SendPastedTextToConnection which adds a pre-processing layer on top of _SendInputToConnection to allow line-ending conversion > - Various code in Profile/TerminalSettings to support the new option "convertPasteLineEndings" (optional, defaults to false) <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed I performed a manual test, ensuring this would not break any current code.
claunia added the pull-request label 2026-01-31 09:05:13 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24764