[PR #3956] [MERGED] Make the terminal parser/adapter and related classes use modern, safe structures #25571

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/3956
Author: @miniksa
Created: 12/13/2019
Status: Merged
Merged: 12/19/2019
Merged by: @miniksa

Base: masterHead: dev/miniksa/gardening3


📝 Commits (10+)

  • 7461678 Adjust the public methods to the state machine to use more modern constructs, propagate changes out.
  • 169bfb3 State Machine, Output State Machine Engine, and Tracing classes use references, string views, standard types.
  • 64d1496 InputStateMachine and associated fallout
  • fee4b54 Dropping hungarians, using unique_ptr constructors, BOOL to bool, using string views everywhere, size_ts over smaller sizes in prep for massive buffers, and so on and so on.
  • dcf0e8f Fix logical conversion errors discovered by running test suite.
  • d97a4da Remove many but probably not all of the std::wstring intermediates being used for calling ProcessString on the parser in the tests.
  • 68bc729 found the other one.
  • e73d516 Fix a few things I found in self-review.
  • 3a92383 Merge branch 'master' into dev/miniksa/gardening3
  • a2c234a Merge branch 'master' into dev/miniksa/gardening3

📊 Changes

52 files changed (+4145 additions, -4508 deletions)

View changed files

📝 src/cascadia/TerminalCore/ITerminalApi.hpp (+7 -7)
📝 src/cascadia/TerminalCore/Terminal.cpp (+5 -2)
📝 src/cascadia/TerminalCore/Terminal.hpp (+6 -6)
📝 src/cascadia/TerminalCore/TerminalApi.cpp (+20 -20)
📝 src/cascadia/TerminalCore/TerminalDispatch.cpp (+33 -33)
📝 src/cascadia/TerminalCore/TerminalDispatch.hpp (+15 -17)
📝 src/cascadia/TerminalCore/TerminalDispatchGraphics.cpp (+37 -39)
📝 src/host/VtInputThread.cpp (+5 -6)
📝 src/host/_stream.cpp (+1 -1)
📝 src/host/getset.cpp (+19 -29)
📝 src/host/getset.h (+6 -6)
📝 src/host/outputStream.cpp (+240 -222)
📝 src/host/outputStream.hpp (+67 -67)
📝 src/host/screenInfo.cpp (+6 -7)
📝 src/host/ut_host/ScreenBufferTests.cpp (+121 -230)
📝 src/host/ut_host/TextBufferTests.cpp (+55 -55)
📝 src/inc/ITerminalOutputConnection.hpp (+2 -2)
📝 src/inc/LibraryIncludes.h (+1 -0)
📝 src/renderer/vt/WinTelnetEngine.cpp (+1 -1)
📝 src/renderer/vt/WinTelnetEngine.hpp (+1 -1)

...and 32 more files

📄 Description

Summary of the Pull Request

Refactors parsing/adapting libraries and consumers to use safer and/or more consistent mechanisms for passing information.

PR Checklist

  • I work here
  • Tests still pass
  • Am a core contributor.

Detailed Description of the Pull Request / Additional comments

This is in support of hopefully turning audit mode on to more projects. If I turned it on, it would immediately complain about certain classes of issues like pointer and size, pointer math, etc. The changes in this refactoring will eliminate those off the top.

Additionally, this has caught a bunch of comments all over the VT classes that weren't updated to match the parameters lists.

Additionally, this has caught a handful of member variables on classes that were completely unused (and now gone).

Additionally, I'm killing almost all hungarian and shortening variable names. I'm only really leaving 'p' for pointers.

Additionally, this is vaguely in support of a future where we can have "infinite scrollback" in that I'm moving things to size_t across the board. I know it's a bit of a memory cost, but all the casting and moving between types is error prone and unfun to save a couple bytes.

Validation Steps Performed

  • build it
  • run all the tests

🔄 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/3956 **Author:** [@miniksa](https://github.com/miniksa) **Created:** 12/13/2019 **Status:** ✅ Merged **Merged:** 12/19/2019 **Merged by:** [@miniksa](https://github.com/miniksa) **Base:** `master` ← **Head:** `dev/miniksa/gardening3` --- ### 📝 Commits (10+) - [`7461678`](https://github.com/microsoft/terminal/commit/7461678b90adfbb403daee79a8f766f26a01242f) Adjust the public methods to the state machine to use more modern constructs, propagate changes out. - [`169bfb3`](https://github.com/microsoft/terminal/commit/169bfb310210d088ebee05aef79a2790afcfe0fc) State Machine, Output State Machine Engine, and Tracing classes use references, string views, standard types. - [`64d1496`](https://github.com/microsoft/terminal/commit/64d14962cd749d99c9faf8ebbc6e69a182e57e6d) InputStateMachine and associated fallout - [`fee4b54`](https://github.com/microsoft/terminal/commit/fee4b546769636828699f26843ed8d298d61f4be) Dropping hungarians, using unique_ptr constructors, BOOL to bool, using string views everywhere, size_ts over smaller sizes in prep for massive buffers, and so on and so on. - [`dcf0e8f`](https://github.com/microsoft/terminal/commit/dcf0e8f59cf237bc0e484afafe63f8e66a901f54) Fix logical conversion errors discovered by running test suite. - [`d97a4da`](https://github.com/microsoft/terminal/commit/d97a4da920386c7d087af65cec59f0ab09795a00) Remove many but probably not all of the std::wstring intermediates being used for calling ProcessString on the parser in the tests. - [`68bc729`](https://github.com/microsoft/terminal/commit/68bc7296b93b8de45c149cefc3bfd84a3cb72692) found the other one. - [`e73d516`](https://github.com/microsoft/terminal/commit/e73d51623aca43e68bfa619aa8838350ffb4ccef) Fix a few things I found in self-review. - [`3a92383`](https://github.com/microsoft/terminal/commit/3a92383fa4300aaad94868f88356819598b3f196) Merge branch 'master' into dev/miniksa/gardening3 - [`a2c234a`](https://github.com/microsoft/terminal/commit/a2c234a7b033b3fc119ba97275eb850973fcd507) Merge branch 'master' into dev/miniksa/gardening3 ### 📊 Changes **52 files changed** (+4145 additions, -4508 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalCore/ITerminalApi.hpp` (+7 -7) 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+5 -2) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+6 -6) 📝 `src/cascadia/TerminalCore/TerminalApi.cpp` (+20 -20) 📝 `src/cascadia/TerminalCore/TerminalDispatch.cpp` (+33 -33) 📝 `src/cascadia/TerminalCore/TerminalDispatch.hpp` (+15 -17) 📝 `src/cascadia/TerminalCore/TerminalDispatchGraphics.cpp` (+37 -39) 📝 `src/host/VtInputThread.cpp` (+5 -6) 📝 `src/host/_stream.cpp` (+1 -1) 📝 `src/host/getset.cpp` (+19 -29) 📝 `src/host/getset.h` (+6 -6) 📝 `src/host/outputStream.cpp` (+240 -222) 📝 `src/host/outputStream.hpp` (+67 -67) 📝 `src/host/screenInfo.cpp` (+6 -7) 📝 `src/host/ut_host/ScreenBufferTests.cpp` (+121 -230) 📝 `src/host/ut_host/TextBufferTests.cpp` (+55 -55) 📝 `src/inc/ITerminalOutputConnection.hpp` (+2 -2) 📝 `src/inc/LibraryIncludes.h` (+1 -0) 📝 `src/renderer/vt/WinTelnetEngine.cpp` (+1 -1) 📝 `src/renderer/vt/WinTelnetEngine.hpp` (+1 -1) _...and 32 more files_ </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 Refactors parsing/adapting libraries and consumers to use safer and/or more consistent mechanisms for passing information. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] I work here * [x] Tests still pass * [x] Am a core contributor. <!-- 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 This is in support of hopefully turning audit mode on to more projects. If I turned it on, it would immediately complain about certain classes of issues like pointer and size, pointer math, etc. The changes in this refactoring will eliminate those off the top. Additionally, this has caught a bunch of comments all over the VT classes that weren't updated to match the parameters lists. Additionally, this has caught a handful of member variables on classes that were completely unused (and now gone). Additionally, I'm killing almost all hungarian and shortening variable names. I'm only really leaving 'p' for pointers. Additionally, this is vaguely in support of a future where we can have "infinite scrollback" in that I'm moving things to size_t across the board. I know it's a bit of a memory cost, but all the casting and moving between types is error prone and unfun to save a couple bytes. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - [x] build it - [x] run all the tests --- <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:22 +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#25571