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

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

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

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/microsoft/terminal/pull/11062 **State:** closed **Merged:** Yes --- ## 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
claunia added the pull-request label 2026-01-31 09:28:13 +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#28393