[PR #9454] Add "strip line breaks" button to multiline paste warning dialog #27595

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

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

State: closed
Merged: No


Summary of the Pull Request

Adds a button to the multiline paste warning dialog that replaces line breaks (\r\n, \r, and \n) in the clipboard text with spaces before pasting.

PR Checklist

  • Closes I can't change text color in terminal. (#9400)
  • CLA signed.
  • Tests added/passed
  • Documentation updated. If checked, please file a pull request on our docs repo and link it here: #xxx
  • Schema 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

Sets the SecondaryButtonText property on the MultiLinePasteDialog via the Resources.resw file. Adds a condition in TerminalPage::_PasteFromClipboardHandler to check if the secondary button was pressed and to replace line breaks in the text with spaces, if so.

multiline-paste-dialog with three buttons

C++ newbie, feedback welcome.

Questions for reviewers:

  1. Is the new button text ("Strip line breaks") acceptable? Should any of the other text in the dialog be changed?
  2. Is the stripping code appropriate? Should we trim the end of the string as well (I'm not sure if there's a preferred trim function)?

Validation Steps Performed

Manually tested all three buttons with multiline text pastes using \r\n, \r and \n in PowerShell, Command Prompt, and Bash (WSL).

**Original Pull Request:** https://github.com/microsoft/terminal/pull/9454 **State:** closed **Merged:** No --- ## Summary of the Pull Request Adds a button to the multiline paste warning dialog that replaces line breaks (`\r\n`, `\r`, and `\n`) in the clipboard text with spaces before pasting. ## PR Checklist * [x] Closes #9400 * [x] CLA signed. * [ ] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema 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 Sets the `SecondaryButtonText` property on the `MultiLinePasteDialog` via the `Resources.resw` file. Adds a condition in `TerminalPage::_PasteFromClipboardHandler` to check if the secondary button was pressed and to replace line breaks in the text with spaces, if so. ![multiline-paste-dialog with three buttons](https://user-images.githubusercontent.com/651955/110819412-e2d42480-82d9-11eb-9975-7f68426fce35.png) C++ newbie, feedback welcome. ### Questions for reviewers: 1. Is the new button text (_"Strip line breaks"_) acceptable? Should any of the other text in the dialog be changed? 3. Is the stripping code appropriate? Should we trim the end of the string as well (I'm not sure if there's a preferred trim function)? ## Validation Steps Performed Manually tested all three buttons with multiline text pastes using `\r\n`, `\r` and `\n` in PowerShell, Command Prompt, and Bash (WSL).
claunia added the pull-request label 2026-01-31 09:22:52 +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#27595