[PR #2390] [CLOSED] Convert Pasted Line Endings and then send to compty #24915

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2390
Author: @ghost
Created: 8/10/2019
Status: Closed

Base: masterHead: master


📝 Commits (10+)

  • 0768bb1 Adding convertPasteLineEndings
  • c9a30cd The spice must flow. (#2096)
  • 220378e The Azure cloud shell connector (#1808)
  • 0338aa0 Added function to TermControl to convert pasted input into something suitable to send to connection
  • 179cff5 Update CascadiaPackage.wapproj
  • 552e427 Update CascadiaPackage.wapproj
  • fcf284f Update CascadiaSettings.cpp
  • 5cb70e3 Update TermControl.cpp
  • 0ced029 Update Profile.cpp
  • fa68f59 Update Profile.cpp

📊 Changes

9 files changed (+68 additions, -14 deletions)

View changed files

📝 dep/gsl (+1 -1)
📝 src/cascadia/TerminalApp/Profile.cpp (+16 -0)
📝 src/cascadia/TerminalApp/Profile.h (+1 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+33 -12)
📝 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

  • Closes Ligatures do not render under cursor column in Vim (#1091)
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • 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.

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 manual and automated testing to ensure 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/2390 **Author:** [@ghost](https://github.com/ghost) **Created:** 8/10/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (10+) - [`0768bb1`](https://github.com/microsoft/terminal/commit/0768bb1a66928ba2800bce27696d1f517fd99e47) Adding convertPasteLineEndings - [`c9a30cd`](https://github.com/microsoft/terminal/commit/c9a30cda2714f3c9b7146121190bf892e3abbd4b) The spice must flow. (#2096) - [`220378e`](https://github.com/microsoft/terminal/commit/220378e4df8e56c4e0cace0834412395e957dfc7) The Azure cloud shell connector (#1808) - [`0338aa0`](https://github.com/microsoft/terminal/commit/0338aa06022228e30b52018e56405ef21e3f4262) Added function to TermControl to convert pasted input into something suitable to send to connection - [`179cff5`](https://github.com/microsoft/terminal/commit/179cff5059650ce05e8e0aaacb9bb5250715b490) Update CascadiaPackage.wapproj - [`552e427`](https://github.com/microsoft/terminal/commit/552e427caaa5a4d47e696440bb8e72c85291b4c0) Update CascadiaPackage.wapproj - [`fcf284f`](https://github.com/microsoft/terminal/commit/fcf284f5d3f38e1a9a4beb01ebecbfad4a5123d3) Update CascadiaSettings.cpp - [`5cb70e3`](https://github.com/microsoft/terminal/commit/5cb70e3d3d5bb4da02c003d6ae010a83651e894a) Update TermControl.cpp - [`0ced029`](https://github.com/microsoft/terminal/commit/0ced029539fe530586eea7c3c7e442e8ca563f36) Update Profile.cpp - [`fa68f59`](https://github.com/microsoft/terminal/commit/fa68f595b7519fbba9a2211fb4de260d32a46355) Update Profile.cpp ### 📊 Changes **9 files changed** (+68 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `dep/gsl` (+1 -1) 📝 `src/cascadia/TerminalApp/Profile.cpp` (+16 -0) 📝 `src/cascadia/TerminalApp/Profile.h` (+1 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+33 -12) 📝 `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. <!-- 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 manual and automated testing to ensure 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:06:05 +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#24915