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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9454
Author: @Nacimota
Created: 3/11/2021
Status: Closed

Base: mainHead: strip-line-breaks-9400


📝 Commits (6)

  • 9047e83 Add "strip line breaks" button to multiline paste warning dialog
  • 63e7da0 Fix formatting
  • b57678c Change button wording on multiline paste warning dialog
  • 56d885f Add comments for multiline paste dialog in resources.resw
  • b91d952 Update comments for multiline paste dialog in resources.resw
  • eaee62a Merge remote-tracking branch 'upstream/main' into strip-line-breaks-9400

📊 Changes

2 files changed (+16 additions, -2 deletions)

View changed files

📝 src/cascadia/TerminalApp/Resources/en-US/Resources.resw (+6 -1)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+10 -1)

📄 Description

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).


🔄 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/9454 **Author:** [@Nacimota](https://github.com/Nacimota) **Created:** 3/11/2021 **Status:** ❌ Closed **Base:** `main` ← **Head:** `strip-line-breaks-9400` --- ### 📝 Commits (6) - [`9047e83`](https://github.com/microsoft/terminal/commit/9047e831f65e36687736dae41184dbf49d2a4249) Add "strip line breaks" button to multiline paste warning dialog - [`63e7da0`](https://github.com/microsoft/terminal/commit/63e7da09925e4e4c6500d49129642f8f725dbe7a) Fix formatting - [`b57678c`](https://github.com/microsoft/terminal/commit/b57678cc4cdc122a8117954dd8d9f36ac6c9e28e) Change button wording on multiline paste warning dialog - [`56d885f`](https://github.com/microsoft/terminal/commit/56d885ff1f8782d21e017a4ddd45d13dfd130d38) Add comments for multiline paste dialog in resources.resw - [`b91d952`](https://github.com/microsoft/terminal/commit/b91d952253a4a851ee7842950d9b8be8020bebaf) Update comments for multiline paste dialog in resources.resw - [`eaee62a`](https://github.com/microsoft/terminal/commit/eaee62aa5f2d7f63fd19c25f6598c650c493507a) Merge remote-tracking branch 'upstream/main' into strip-line-breaks-9400 ### 📊 Changes **2 files changed** (+16 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/Resources/en-US/Resources.resw` (+6 -1) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+10 -1) </details> ### 📄 Description ## 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). --- <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:22:51 +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#27590