[PR #11062] [MERGED] Allow exporting terminal buffer into file via tab context menu #28388

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/11062
Author: @Don-Vito
Created: 8/27/2021
Status: Merged
Merged: 8/31/2021
Merged by: @undefined

Base: mainHead: 642-export-buffer


📝 Commits (4)

  • 6351807 Allow exporting terminal buffer into file via tab context menu
  • 136ca87 Postpone reading the text buffer post file selection
  • b64b840 Move file storing into CoreControl
  • f49c07b Revert moving the file operations to TermControl

📊 Changes

12 files changed (+129 additions, -0 deletions)

View changed files

📝 src/cascadia/TerminalApp/Resources/en-US/Resources.resw (+12 -0)
📝 src/cascadia/TerminalApp/TabManagement.cpp (+52 -0)
📝 src/cascadia/TerminalApp/TerminalPage.h (+1 -0)
📝 src/cascadia/TerminalApp/TerminalTab.cpp (+19 -0)
📝 src/cascadia/TerminalApp/TerminalTab.h (+1 -0)
📝 src/cascadia/TerminalApp/pch.h (+3 -0)
📝 src/cascadia/TerminalControl/ControlCore.cpp (+28 -0)
📝 src/cascadia/TerminalControl/ControlCore.h (+2 -0)
📝 src/cascadia/TerminalControl/ControlCore.idl (+2 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+5 -0)
📝 src/cascadia/TerminalControl/TermControl.h (+2 -0)
📝 src/cascadia/TerminalControl/TermControl.idl (+2 -0)

📄 Description

Summary of the Pull Request

Naive implementation of exporting the text buffer of the current pane
into a text file triggered from the tab context menu.

Disclaimer: this is not an export of the command history,
but rather just a text buffer dumped into a file when asked explicitly.

References

Should provide partial solution for #642.

Detailed Description of the Pull Request / Additional comments

The logic is following:

  • Open a file save picker
    • The location is Downloads folder (should be always accessible)
    • The suggest name of the file equals to the pane's title
    • The allowed file formats list contains .txt only
  • If no file selected stop
  • Lock terminal
  • Read all lines till the cursor
  • Format each line by removing trailing white-spaces and adding CRLF if not wrapped
  • Asynchronously write to selected file
  • Show confirmation

As the action is relatively fast didn't add a progress bar or any other UX.
As the buffer is relatively small, holding it entirely in the memory rather than
writing line by line to disk.

Closes #642


🔄 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/11062 **Author:** [@Don-Vito](https://github.com/Don-Vito) **Created:** 8/27/2021 **Status:** ✅ Merged **Merged:** 8/31/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `642-export-buffer` --- ### 📝 Commits (4) - [`6351807`](https://github.com/microsoft/terminal/commit/6351807b2ee70b52ef9d11154e4e7f78e3bad9a1) Allow exporting terminal buffer into file via tab context menu - [`136ca87`](https://github.com/microsoft/terminal/commit/136ca87a99fba0ac65e21ee4502354d2ffadb93b) Postpone reading the text buffer post file selection - [`b64b840`](https://github.com/microsoft/terminal/commit/b64b840d947d1bce8478ca27d81c0922b1afc383) Move file storing into CoreControl - [`f49c07b`](https://github.com/microsoft/terminal/commit/f49c07b942626163bc7af4c78d1df8d38aec0f02) Revert moving the file operations to TermControl ### 📊 Changes **12 files changed** (+129 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/Resources/en-US/Resources.resw` (+12 -0) 📝 `src/cascadia/TerminalApp/TabManagement.cpp` (+52 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+1 -0) 📝 `src/cascadia/TerminalApp/TerminalTab.cpp` (+19 -0) 📝 `src/cascadia/TerminalApp/TerminalTab.h` (+1 -0) 📝 `src/cascadia/TerminalApp/pch.h` (+3 -0) 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+28 -0) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+2 -0) 📝 `src/cascadia/TerminalControl/ControlCore.idl` (+2 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+5 -0) 📝 `src/cascadia/TerminalControl/TermControl.h` (+2 -0) 📝 `src/cascadia/TerminalControl/TermControl.idl` (+2 -0) </details> ### 📄 Description ## Summary of the Pull Request **Naive implementation** of exporting the text buffer of the current pane into a text file triggered from the tab context menu. **Disclaimer: this is not an export of the command history,** but rather just a text buffer dumped into a file when asked explicitly. ## References Should provide partial solution for #642. ## Detailed Description of the Pull Request / Additional comments The logic is following: * Open a file save picker * The location is Downloads folder (should be always accessible) * The suggest name of the file equals to the pane's title * The allowed file formats list contains .txt only * If no file selected stop * Lock terminal * Read all lines till the cursor * Format each line by removing trailing white-spaces and adding CRLF if not wrapped * Asynchronously write to selected file * Show confirmation As the action is relatively fast didn't add a progress bar or any other UX. As the buffer is relatively small, holding it entirely in the memory rather than writing line by line to disk. Closes #642 --- <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:28: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#28388