[PR #4125] [MERGED] Correct passthrough sequences after refactor #25651

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/4125
Author: @miniksa
Created: 1/6/2020
Status: ✅ Merged
Merged: 1/8/2020
Merged by: @undefined

Base: master ← Head: dev/miniksa/4116


📝 Commits (8)

  • c39bb8a Adjust the run stored to fix truncation issue.
  • 89bbdc0 Wrote test.
  • c8f87fa Merge branch 'dev/miniksa/4116_fix' into dev/miniksa/4116
  • 106bf1b Additional test to ensure that run storage for the other case through the ProcessString loop continues to work correctly with _run storage.
  • d204578 Add one more test for a large bulk of text and correct the final substring. Add comments to loop to explain _run operation since it's confusing.
  • 006695d check the passthrough on the backwards string print too because why not.
  • ceff932 Merge branch 'master' into dev/miniksa/4116
  • 1ff0037 Merge branch 'master' into dev/miniksa/4116

📊 Changes

2 files changed (+98 additions, -7 deletions)

View changed files

📝 src/terminal/parser/stateMachine.cpp (+16 -3)
📝 src/terminal/parser/ut_parser/StateMachineTest.cpp (+82 -4)

📄 Description

Summary of the Pull Request

When refactoring the StateMachine::ProcessString algorithm to use safer structures, I made an off-by-one error when attempting to simplify the loop.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

The algorithm in use exploited holding onto some pointers and sizes as it rotated around the loop to call back as member variables in the pass-through function FlushToTerminal.

As a part of the refactor, I adjusted to persisting a std::wstring_view of the currently processing string instead of pointer/size. I also attempted to simplify the loop at the same time as both the individual and group branches were performing some redundant operations in respect to updating the "run" length.

Turns out, I made a mistake here. I wrote it so it worked correctly for the bottom half where we transition from bulk printing to an escape but then I messed up the top case.

Validation Steps Performed

  • Manual validation of the exact command given in the bug report.
  • Wrote automated tests to validate both paths through the ProcessString loop that work with the _run variable.

🔄 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/4125 **Author:** [@miniksa](https://github.com/miniksa) **Created:** 1/6/2020 **Status:** ✅ Merged **Merged:** 1/8/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/miniksa/4116` --- ### 📝 Commits (8) - [`c39bb8a`](https://github.com/microsoft/terminal/commit/c39bb8a2b8903570a9ed078620326a327ea5ac90) Adjust the run stored to fix truncation issue. - [`89bbdc0`](https://github.com/microsoft/terminal/commit/89bbdc08a4e493ea57245547a5a4dcb3c7e01631) Wrote test. - [`c8f87fa`](https://github.com/microsoft/terminal/commit/c8f87fa3b4210cd57df4dd696dbf768c8e242fc3) Merge branch 'dev/miniksa/4116_fix' into dev/miniksa/4116 - [`106bf1b`](https://github.com/microsoft/terminal/commit/106bf1b9a8bf7145d12d1ba4e3f7e5b5c0902649) Additional test to ensure that run storage for the other case through the ProcessString loop continues to work correctly with _run storage. - [`d204578`](https://github.com/microsoft/terminal/commit/d20457818091381aa88e3b51904a416152efe88c) Add one more test for a large bulk of text and correct the final substring. Add comments to loop to explain _run operation since it's confusing. - [`006695d`](https://github.com/microsoft/terminal/commit/006695db4f116ffd301fcbb3bd721ccb2adc4b5b) check the passthrough on the backwards string print too because why not. - [`ceff932`](https://github.com/microsoft/terminal/commit/ceff9329217fc38eaf76e7d64ebba0f1df406770) Merge branch 'master' into dev/miniksa/4116 - [`1ff0037`](https://github.com/microsoft/terminal/commit/1ff00374d0a81d5356a2b1e047fb9ce1b620014d) Merge branch 'master' into dev/miniksa/4116 ### 📊 Changes **2 files changed** (+98 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/terminal/parser/stateMachine.cpp` (+16 -3) 📝 `src/terminal/parser/ut_parser/StateMachineTest.cpp` (+82 -4) </details> ### 📄 Description ## Summary of the Pull Request When refactoring the `StateMachine::ProcessString` algorithm to use safer structures, I made an off-by-one error when attempting to simplify the loop. ## References - Introduced in #3956 ## PR Checklist * [x] Closes #4116 * [x] I work here. * [x] Tests added/passed * [x] No documentation * [x] I'm a core contributor. ## Detailed Description of the Pull Request / Additional comments The algorithm in use exploited holding onto some pointers and sizes as it rotated around the loop to call back as member variables in the pass-through function `FlushToTerminal`. As a part of the refactor, I adjusted to persisting a `std::wstring_view` of the currently processing string instead of pointer/size. I also attempted to simplify the loop at the same time as both the individual and group branches were performing some redundant operations in respect to updating the "run" length. Turns out, I made a mistake here. I wrote it so it worked correctly for the bottom half where we transition from bulk printing to an escape but then I messed up the top case. ## Validation Steps Performed - [x] Manual validation of the exact command given in the bug report. - [x] Wrote automated tests to validate both paths through the `ProcessString` loop that work with the `_run` variable. --- <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:10:53 +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#25651