[PR #2009] [CLOSED] Convert pasted line endings #24759

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2009
Author: @ghost
Created: 7/17/2019
Status: Closed

Base: masterHead: master


📝 Commits (10+)

  • 5d60f7d Adding convertPasteLineEndings
  • 24406f7 f
  • 6343bd0 Convert paste line endings
  • 5de9819 Fixed Typo
  • 461f68c Changed it so that no compiler upgrade is needed, because it cannot detect regex
  • ea3cc88 Revert "Changed it so that no compiler upgrade is needed, because it cannot detect regex"
  • 8aad3e0 Revert "Fixed Typo"
  • ec4f595 Fixed typo
  • b37f01b fixed line
  • 17d13f1 Include regex so we can process the string being copied.

📊 Changes

11 files changed (+74 additions, -24 deletions)

View changed files

📝 dep/gsl (+1 -1)
📝 src/cascadia/CascadiaPackage/CascadiaPackage.wapproj (+2 -3)
📝 src/cascadia/TerminalApp/CascadiaSettings.cpp (+1 -1)
📝 src/cascadia/TerminalApp/Profile.cpp (+16 -0)
📝 src/cascadia/TerminalApp/Profile.h (+1 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+36 -18)
📝 src/cascadia/TerminalControl/TermControl.h (+1 -0)
📝 src/cascadia/TerminalSettings/IControlSettings.idl (+2 -0)
📝 src/cascadia/TerminalSettings/TerminalSettings.cpp (+11 -0)
📝 src/cascadia/TerminalSettings/terminalsettings.h (+3 -0)
📝 src/propsheet/ColorsPage.cpp (+0 -1)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/2009 **Author:** [@ghost](https://github.com/ghost) **Created:** 7/17/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (10+) - [`5d60f7d`](https://github.com/microsoft/terminal/commit/5d60f7df44990731c504ccde03dacf28ce188d75) Adding convertPasteLineEndings - [`24406f7`](https://github.com/microsoft/terminal/commit/24406f78f1884b849f839c1f07f67763160d5f7c) f - [`6343bd0`](https://github.com/microsoft/terminal/commit/6343bd0ad0f4f616b7844285fb7b32fc29267a5a) Convert paste line endings - [`5de9819`](https://github.com/microsoft/terminal/commit/5de9819a455a5e81020516d1e427573b97a49838) Fixed Typo - [`461f68c`](https://github.com/microsoft/terminal/commit/461f68c0df26a82f942325ea2be55a45e7ae4928) Changed it so that no compiler upgrade is needed, because it cannot detect regex - [`ea3cc88`](https://github.com/microsoft/terminal/commit/ea3cc88cb797ccc6f5170031aa41b18a027a05a6) Revert "Changed it so that no compiler upgrade is needed, because it cannot detect regex" - [`8aad3e0`](https://github.com/microsoft/terminal/commit/8aad3e00c83ed6bc6a2e74ac3fc5cc51d13d59d7) Revert "Fixed Typo" - [`ec4f595`](https://github.com/microsoft/terminal/commit/ec4f595f54a14257482d516fc6557ed0c2561f87) Fixed typo - [`b37f01b`](https://github.com/microsoft/terminal/commit/b37f01b6764078874842e5d0bf416d8089762b78) fixed line - [`17d13f1`](https://github.com/microsoft/terminal/commit/17d13f18e7439080ddb42e9dc5d79e1f1046abc4) Include regex so we can process the string being copied. ### 📊 Changes **11 files changed** (+74 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `dep/gsl` (+1 -1) 📝 `src/cascadia/CascadiaPackage/CascadiaPackage.wapproj` (+2 -3) 📝 `src/cascadia/TerminalApp/CascadiaSettings.cpp` (+1 -1) 📝 `src/cascadia/TerminalApp/Profile.cpp` (+16 -0) 📝 `src/cascadia/TerminalApp/Profile.h` (+1 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+36 -18) 📝 `src/cascadia/TerminalControl/TermControl.h` (+1 -0) 📝 `src/cascadia/TerminalSettings/IControlSettings.idl` (+2 -0) 📝 `src/cascadia/TerminalSettings/TerminalSettings.cpp` (+11 -0) 📝 `src/cascadia/TerminalSettings/terminalsettings.h` (+3 -0) 📝 `src/propsheet/ColorsPage.cpp` (+0 -1) </details> ### 📄 Description <!-- 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:05:12 +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#24759