Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and simplify the ConGetSet API #12247

Merged
30 commits merged into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e9a3992
Remove DoSrvPrivateWriteConsoleInputW.
j4james Dec 28, 2021
ce0f0d1
Remove DoSrvPrivateSetAutoWrapMode.
j4james Dec 29, 2021
3eb03bd
Remove DoSrvPrivateShowCursor.
j4james Dec 29, 2021
e5b141c
Remove DoSrvPrivateAllowCursorBlinking.
j4james Dec 29, 2021
841a357
Remove DoSrvPrivateSetScrollingRegion.
j4james Dec 29, 2021
d5cc106
Remove DoSrvPrivateLineFeed.
j4james Dec 29, 2021
e1992ed
Remove DoSrvPrivateReverseLineFeed.
j4james Dec 30, 2021
6d13028
Remove DoSrvPrivateUseAlternateScreenBuffer.
j4james Dec 30, 2021
5568c9e
Remove DoSrvPrivateUseMainScreenBuffer.
j4james Dec 30, 2021
7b05ba5
Remove DoSrvPrivateEraseAll.
j4james Dec 30, 2021
662321d
Remove DoSrvPrivateClearBuffer.
j4james Dec 30, 2021
91edb2b
Remove DoSrvSetCursorStyle.
j4james Dec 30, 2021
cff545d
Remove DoSrvPrivateRefreshWindow.
j4james Dec 31, 2021
c1d60c7
Remove DoSrvPrivateWriteConsoleControlInput.
j4james Jan 11, 2022
b3ee852
Remove DoSrvGetConsoleOutputCodePage.
j4james Jan 11, 2022
1e9796b
Remove DoSrvPrivateSuppressResizeRepaint.
j4james Jan 11, 2022
e19f603
Remove DoSrvIsConsolePty.
j4james Jan 11, 2022
190edc3
Remove DoSrvPrivateDeleteLines and DoSrvPrivateInsertLines.
j4james Jan 11, 2022
4ef5075
Remove DoSrvPrivateMoveToBottom.
j4james Jan 11, 2022
4368bdd
Remove DoSrvPrivateFillRegion.
j4james Jan 11, 2022
dee2974
Remove DoSrvPrivateScrollRegion.
j4james Jan 11, 2022
1ddf056
Remove DoSrvAddHyperlink and DoSrvEndHyperlink.
j4james Jan 11, 2022
0340543
Remove DoSrvUpdateSoftFont.
j4james Jan 11, 2022
6eadadb
Remove DoSrvSetConsoleTitleW.
j4james Jan 11, 2022
38a5b50
Clean up ConGetSet method names.
j4james Jan 13, 2022
407ec4b
Add exception trapping in the state machine.
j4james Jan 22, 2022
4af4b2f
Remove exception trapping downstream of state machine.
j4james Jan 22, 2022
f0da56a
Only return bool to indicate conpty passthrough.
j4james Jan 23, 2022
a3a305b
Update adapter tests to handle API changes.
j4james Jan 24, 2022
576b6bb
Merge branch 'main' into refactor-congetset
j4james Jan 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void ConptyRoundtripTests::_resizeConpty(const unsigned short sx,
void ConptyRoundtripTests::_clearConpty()
{
// Taken verbatim from implementation in PtySignalInputThread::_DoClearBuffer
_pConApi->PrivateClearBuffer();
_pConApi->ClearBuffer();
}

[[nodiscard]] std::tuple<TextBuffer*, TextBuffer*> ConptyRoundtripTests::_performResize(const til::size newSize)
Expand Down
2 changes: 1 addition & 1 deletion src/host/PtySignalInputThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void PtySignalInputThread::_DoResizeWindow(const ResizeWindowData& data)

void PtySignalInputThread::_DoClearBuffer()
{
_pConApi->PrivateClearBuffer();
_pConApi->ClearBuffer();
}

// Method Description:
Expand Down
2 changes: 0 additions & 2 deletions src/host/cmdline.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ void RedrawCommandLine(COOKED_READ_DATA& cookedReadData);
bool IsWordDelim(const wchar_t wch);
bool IsWordDelim(const std::wstring_view charData);

[[nodiscard]] HRESULT DoSrvSetConsoleTitleW(const std::wstring_view title) noexcept;

bool IsValidStringBuffer(_In_ bool Unicode, _In_reads_bytes_(Size) PVOID Buffer, _In_ ULONG Size, _In_ ULONG Count, ...);

void SetCurrentCommandLine(COOKED_READ_DATA& cookedReadData, _In_ SHORT Index);
44 changes: 0 additions & 44 deletions src/host/directio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,24 +443,6 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
CATCH_RETURN();
}

// Routine Description:
// - Writes events to the input buffer already formed into IInputEvents (private call)
// Arguments:
// - context - the input buffer to write to
// - events - the events to written
// - written - on output, the number of events written
// - append - true if events should be written to the end of the input
// buffer, false if they should be written to the front
// Return Value:
// - HRESULT indicating success or failure
[[nodiscard]] HRESULT DoSrvPrivateWriteConsoleInputW(_Inout_ InputBuffer* const pInputBuffer,
_Inout_ std::deque<std::unique_ptr<IInputEvent>>& events,
_Out_ size_t& eventsWritten,
const bool append) noexcept
{
return _WriteConsoleInputWImplHelper(*pInputBuffer, events, eventsWritten, append);
}

// Routine Description:
// - Writes events to the input buffer, translating from codepage to unicode first
// Arguments:
Expand Down Expand Up @@ -534,32 +516,6 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
CATCH_RETURN();
}

// Function Description:
// - Writes the input KeyEvent to the console as a console control event. This
// can be used for potentially generating Ctrl-C events, as
// HandleGenericKeyEvent will correctly generate the Ctrl-C response in
// the same way that it'd be handled from the window proc, with the proper
// processed vs raw input handling.
// If the input key is *not* a Ctrl-C key, then it will get written to the
// buffer just the same as any other KeyEvent.
// Arguments:
// - pInputBuffer - the input buffer to write to. Currently unused, as
// HandleGenericKeyEvent just gets the global input buffer, but all
// ConGetSet API's require an input or output object.
// - key - The keyevent to send to the console.
// Return Value:
// - HRESULT indicating success or failure
[[nodiscard]] HRESULT DoSrvPrivateWriteConsoleControlInput(_Inout_ InputBuffer* const /*pInputBuffer*/,
_In_ KeyEvent key)
{
LockConsole();
auto Unlock = wil::scope_exit([&] { UnlockConsole(); });

HandleGenericKeyEvent(key, false);

return S_OK;
}

// Routine Description:
// - This is used when the app is reading output as cells and needs them converted
// into a particular codepage on the way out.
Expand Down
8 changes: 0 additions & 8 deletions src/host/directio.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ Revision History:

class SCREEN_INFORMATION;

[[nodiscard]] HRESULT DoSrvPrivateWriteConsoleInputW(_Inout_ InputBuffer* const pInputBuffer,
_Inout_ std::deque<std::unique_ptr<IInputEvent>>& events,
_Out_ size_t& eventsWritten,
const bool append) noexcept;

[[nodiscard]] NTSTATUS ConsoleCreateScreenBuffer(std::unique_ptr<ConsoleHandleData>& handle,
_In_ PCONSOLE_API_MSG Message,
_In_ PCD_CREATE_OBJECT_INFORMATION Information,
_In_ PCONSOLE_CREATESCREENBUFFER_MSG a);

[[nodiscard]] NTSTATUS DoSrvPrivateWriteConsoleControlInput(_Inout_ InputBuffer* const pInputBuffer,
_In_ KeyEvent key);
Loading