[PR #2665] [CLOSED] Immediately flush a frame when we encounter a string we don't understand #25023

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2665
Author: @zadjii-msft
Created: 9/5/2019
Status: Closed

Base: masterHead: dev/migrie/b/2011-reordered-fallthrough-strings


📝 Commits (5)

  • 5a36578 I think this fixes it
  • 9ca8b98 Fix build, Add comments
  • d9953f6 Remove some dead code
  • 30ef50f Merge branch 'master' into dev/migrie/b/2011-reordered-fallthrough-strings
  • 6a4c324 remove ITerminalOutputConnection from OutputStateMachineEngine

📊 Changes

19 files changed (+143 additions, -22 deletions)

View changed files

📝 src/cascadia/TerminalCore/TerminalDispatch.cpp (+17 -0)
📝 src/cascadia/TerminalCore/TerminalDispatch.hpp (+1 -0)
📝 src/host/VtIo.cpp (+21 -0)
📝 src/host/VtIo.hpp (+1 -0)
📝 src/host/getset.cpp (+34 -0)
📝 src/host/getset.h (+2 -0)
📝 src/host/outputStream.cpp (+15 -0)
📝 src/host/outputStream.hpp (+2 -0)
📝 src/host/screenInfo.cpp (+2 -4)
📝 src/terminal/adapter/ITermDispatch.hpp (+2 -0)
📝 src/terminal/adapter/adaptDispatch.cpp (+15 -0)
📝 src/terminal/adapter/adaptDispatch.hpp (+3 -0)
📝 src/terminal/adapter/conGetSet.hpp (+2 -0)
📝 src/terminal/adapter/ut_adapter/adapterTest.cpp (+6 -0)
📝 src/terminal/parser/OutputStateMachineEngine.cpp (+2 -15)
📝 src/terminal/parser/OutputStateMachineEngine.hpp (+1 -3)
📝 src/terminal/parser/ft_fuzzwrapper/echoDispatch.cpp (+6 -0)
📝 src/terminal/parser/ft_fuzzwrapper/echoDispatch.hpp (+1 -0)
📝 src/terminal/parser/ut_parser/OutputEngineTest.cpp (+10 -0)

📄 Description

Summary of the Pull Request

Whenever conpty encounters a VT sequence it doesn't understand, we'll make sure to flush the current frame before writing that string through to the connected terminal application.

References

This might have some long-term consequences for #1173. IIRC I wrote some code that was fairly similar for passthrough mode. This might be a subset of that code.

PR Checklist

  • Closes Bug Report (#2011)
  • I work here
  • Tests added/passed
  • [n/a] Requires documentation to be updated

Detailed Description of the Pull Request / Additional comments

We need to do this because some VT sequences might be dependent upon state that's currently buffered in the frame. So we'll flush the frame so the terminal also has that state, then we'll write the sequence we didn't understand/wanted to passthrough.

Validation Steps Performed

While testing this might be a bit trickier, I wrote a test script that changes the cursor color, in the middle of a big block of text. Changing the cursor color is a VT sequence we passthrough always. Before the change, the cursor color sequence would always appear before any of the related text. After the change, the text before the color sequence is always emitted before the sequence, and the text after the sequence is always emitted after.


🔄 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/2665 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 9/5/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `dev/migrie/b/2011-reordered-fallthrough-strings` --- ### 📝 Commits (5) - [`5a36578`](https://github.com/microsoft/terminal/commit/5a36578ef231d2892190910c814f7c06526185a1) I think this fixes it - [`9ca8b98`](https://github.com/microsoft/terminal/commit/9ca8b98863d2975cdffbf53422e6a6a12903da37) Fix build, Add comments - [`d9953f6`](https://github.com/microsoft/terminal/commit/d9953f6fe05b9cbd9becc4b3d70a97692e5ae4dc) Remove some dead code - [`30ef50f`](https://github.com/microsoft/terminal/commit/30ef50fd9bd8a4dc3dd187d573eb10a8993defa4) Merge branch 'master' into dev/migrie/b/2011-reordered-fallthrough-strings - [`6a4c324`](https://github.com/microsoft/terminal/commit/6a4c3248791cb8966b4869c54ab55bc5edfdc7ef) remove ITerminalOutputConnection from OutputStateMachineEngine ### 📊 Changes **19 files changed** (+143 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalCore/TerminalDispatch.cpp` (+17 -0) 📝 `src/cascadia/TerminalCore/TerminalDispatch.hpp` (+1 -0) 📝 `src/host/VtIo.cpp` (+21 -0) 📝 `src/host/VtIo.hpp` (+1 -0) 📝 `src/host/getset.cpp` (+34 -0) 📝 `src/host/getset.h` (+2 -0) 📝 `src/host/outputStream.cpp` (+15 -0) 📝 `src/host/outputStream.hpp` (+2 -0) 📝 `src/host/screenInfo.cpp` (+2 -4) 📝 `src/terminal/adapter/ITermDispatch.hpp` (+2 -0) 📝 `src/terminal/adapter/adaptDispatch.cpp` (+15 -0) 📝 `src/terminal/adapter/adaptDispatch.hpp` (+3 -0) 📝 `src/terminal/adapter/conGetSet.hpp` (+2 -0) 📝 `src/terminal/adapter/ut_adapter/adapterTest.cpp` (+6 -0) 📝 `src/terminal/parser/OutputStateMachineEngine.cpp` (+2 -15) 📝 `src/terminal/parser/OutputStateMachineEngine.hpp` (+1 -3) 📝 `src/terminal/parser/ft_fuzzwrapper/echoDispatch.cpp` (+6 -0) 📝 `src/terminal/parser/ft_fuzzwrapper/echoDispatch.hpp` (+1 -0) 📝 `src/terminal/parser/ut_parser/OutputEngineTest.cpp` (+10 -0) </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 Whenever conpty encounters a VT sequence it doesn't understand, we'll make sure to flush the current frame before writing that string through to the connected terminal application. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References This might have some long-term consequences for #1173. IIRC I wrote some code that was fairly similar for passthrough mode. This might be a subset of that code. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #2011 * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated <!-- 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 We need to do this because some VT sequences might be dependent upon state that's currently buffered in the frame. So we'll flush the frame so the terminal also has that state, then we'll write the sequence we didn't understand/wanted to passthrough. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed While testing this might be a bit trickier, I wrote a test script that changes the cursor color, in the middle of a big block of text. Changing the cursor color is a VT sequence we passthrough always. Before the change, the cursor color sequence would always appear _before_ any of the related text. After the change, the text before the color sequence is always emitted before the sequence, and the text after the sequence is always emitted after. --- <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:46 +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#25023