[PR #12390] [MERGED] Eliminate the AdaptDefaults class #29013

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12390
Author: @j4james
Created: 2/5/2022
Status: Merged
Merged: 2/9/2022
Merged by: @undefined

Base: mainHead: nuke-adaptdefaults


📝 Commits (5)

  • 611173b Remove unused Execute(Char) methods.
  • 654c750 Remove unneeded AdaptDefaults::Print method.
  • fc5ed8b Move PrintString into ConGetSet.
  • 5b28bad Delete remains of AdaptDefaults class.
  • 7f944af Merge branch 'main' into nuke-adaptdefaults

📊 Changes

20 files changed (+31 additions, -187 deletions)

View changed files

📝 src/cascadia/TerminalCore/ITerminalApi.hpp (+0 -1)
📝 src/cascadia/TerminalCore/Terminal.hpp (+0 -1)
📝 src/cascadia/TerminalCore/TerminalApi.cpp (+0 -5)
📝 src/cascadia/TerminalCore/TerminalDispatch.cpp (+0 -5)
📝 src/cascadia/TerminalCore/TerminalDispatch.hpp (+0 -1)
📝 src/host/outputStream.cpp (+13 -61)
📝 src/host/outputStream.hpp (+3 -26)
📝 src/host/screenInfo.cpp (+1 -2)
📝 src/terminal/adapter/ITermDispatch.hpp (+0 -1)
src/terminal/adapter/adaptDefaults.hpp (+0 -30)
📝 src/terminal/adapter/adaptDispatch.cpp (+4 -7)
📝 src/terminal/adapter/adaptDispatch.hpp (+2 -10)
📝 src/terminal/adapter/conGetSet.hpp (+3 -0)
📝 src/terminal/adapter/lib/adapter.vcxproj (+0 -1)
📝 src/terminal/adapter/lib/adapter.vcxproj.filters (+0 -3)
📝 src/terminal/adapter/termDispatch.hpp (+0 -1)
📝 src/terminal/adapter/ut_adapter/adapterTest.cpp (+5 -18)
📝 src/terminal/parser/ft_fuzzwrapper/echoDispatch.cpp (+0 -5)
📝 src/terminal/parser/ft_fuzzwrapper/echoDispatch.hpp (+0 -1)
📝 src/terminal/parser/ut_parser/OutputEngineTest.cpp (+0 -8)

📄 Description

Summary of the Pull Request

The only method that was really needed in the AdaptDefault class was
the PrintString method, and that could easily be moved into the
ConGetSet interface. That lets us get rid of the AdaptDefault class
altogether, simplifying the construction of the AdaptDispatch class,
and brings us more in line with the TerminalDispatch implementation.

PR Checklist

Detailed Description of the Pull Request / Additional comments

The Execute method was never used at all, so there was no problem with
losing that. But I also noticed there was an equivalent ExecuteChar
method in the ITerminalApi interface, which also wasn't being used, so
I've removed that too.

Then there was a Print method taking a single wchar_t parameter, but
that was ultimately implemented as a PrintString call anyway, so that
translation could easily be accomplished in the AdaptDispatch calling
code, the same way it's done in TerminalDispatch.

That left us with the PrintString method, which could simply be moved
into the ConGetSet interface, which would then more closely match the
ITerminalApi interface.

There was also a GetResult method, that returned the status of the
last PrintString, but that result was never actually checked anywhere.
What I've done now is make the PrintString method throw an exception
on failure, and that will be caught and logged in the StateMachine.

Validation Steps Performed

I've started a bash shell in conhost to verify that it still works.
Since almost everything goes through PrintString in VT mode, it should
be obvious if something was broken.


🔄 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/12390 **Author:** [@j4james](https://github.com/j4james) **Created:** 2/5/2022 **Status:** ✅ Merged **Merged:** 2/9/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `nuke-adaptdefaults` --- ### 📝 Commits (5) - [`611173b`](https://github.com/microsoft/terminal/commit/611173be4c3b8328173bced08023704e99007940) Remove unused Execute(Char) methods. - [`654c750`](https://github.com/microsoft/terminal/commit/654c7504879089038a5324fed572532a00718ede) Remove unneeded AdaptDefaults::Print method. - [`fc5ed8b`](https://github.com/microsoft/terminal/commit/fc5ed8beaa74967ee51fbdf9885de1b2e434a7b6) Move PrintString into ConGetSet. - [`5b28bad`](https://github.com/microsoft/terminal/commit/5b28bada0258dc3e003b71834ca106af28dff6f5) Delete remains of AdaptDefaults class. - [`7f944af`](https://github.com/microsoft/terminal/commit/7f944af7a27d13b7af6a90af410ab6d32aac69a9) Merge branch 'main' into nuke-adaptdefaults ### 📊 Changes **20 files changed** (+31 additions, -187 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalCore/ITerminalApi.hpp` (+0 -1) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+0 -1) 📝 `src/cascadia/TerminalCore/TerminalApi.cpp` (+0 -5) 📝 `src/cascadia/TerminalCore/TerminalDispatch.cpp` (+0 -5) 📝 `src/cascadia/TerminalCore/TerminalDispatch.hpp` (+0 -1) 📝 `src/host/outputStream.cpp` (+13 -61) 📝 `src/host/outputStream.hpp` (+3 -26) 📝 `src/host/screenInfo.cpp` (+1 -2) 📝 `src/terminal/adapter/ITermDispatch.hpp` (+0 -1) ➖ `src/terminal/adapter/adaptDefaults.hpp` (+0 -30) 📝 `src/terminal/adapter/adaptDispatch.cpp` (+4 -7) 📝 `src/terminal/adapter/adaptDispatch.hpp` (+2 -10) 📝 `src/terminal/adapter/conGetSet.hpp` (+3 -0) 📝 `src/terminal/adapter/lib/adapter.vcxproj` (+0 -1) 📝 `src/terminal/adapter/lib/adapter.vcxproj.filters` (+0 -3) 📝 `src/terminal/adapter/termDispatch.hpp` (+0 -1) 📝 `src/terminal/adapter/ut_adapter/adapterTest.cpp` (+5 -18) 📝 `src/terminal/parser/ft_fuzzwrapper/echoDispatch.cpp` (+0 -5) 📝 `src/terminal/parser/ft_fuzzwrapper/echoDispatch.hpp` (+0 -1) 📝 `src/terminal/parser/ut_parser/OutputEngineTest.cpp` (+0 -8) </details> ### 📄 Description ## Summary of the Pull Request The only method that was really needed in the `AdaptDefault` class was the `PrintString` method, and that could easily be moved into the `ConGetSet` interface. That lets us get rid of the `AdaptDefault` class altogether, simplifying the construction of the `AdaptDispatch` class, and brings us more in line with the `TerminalDispatch` implementation. ## PR Checklist * [x] Closes #12318 * [x] CLA signed. * [ ] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [x] I've discussed this with core contributors already. Issue number where discussion took place: #12318 ## Detailed Description of the Pull Request / Additional comments The `Execute` method was never used at all, so there was no problem with losing that. But I also noticed there was an equivalent `ExecuteChar` method in the `ITerminalApi` interface, which also wasn't being used, so I've removed that too. Then there was a `Print` method taking a single `wchar_t` parameter, but that was ultimately implemented as a `PrintString` call anyway, so that translation could easily be accomplished in the `AdaptDispatch` calling code, the same way it's done in `TerminalDispatch`. That left us with the `PrintString` method, which could simply be moved into the `ConGetSet` interface, which would then more closely match the `ITerminalApi` interface. There was also a `GetResult` method, that returned the status of the last `PrintString`, but that result was never actually checked anywhere. What I've done now is make the `PrintString` method throw an exception on failure, and that will be caught and logged in the `StateMachine`. ## Validation Steps Performed I've started a bash shell in conhost to verify that it still works. Since almost everything goes through `PrintString` in VT mode, it should be obvious if something was broken. --- <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:32:15 +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#29013