mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
parent
097f7d32a6
commit
e2b5fecd48
@ -1,5 +1,5 @@
|
||||
// EchoCon.cpp : Entry point for the EchoCon Pseudo-Consle sample application.
|
||||
// Copyright © 2018, Microsoft
|
||||
// EchoCon.cpp : Entry point for the EchoCon Pseudo-Console sample application.
|
||||
// Copyright © 2018, Microsoft
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <Windows.h>
|
||||
|
||||
@ -515,7 +515,7 @@ void CommandListPopup::_update(const SHORT originalDelta, const bool wrap)
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Adjusts the highligted line in a list of commands
|
||||
// - Adjusts the highlighted line in a list of commands
|
||||
// Arguments:
|
||||
// - OldCurrentCommand - The previous command highlighted
|
||||
// - NewCurrentCommand - The new command to be highlighted.
|
||||
|
||||
@ -102,7 +102,7 @@ void ConsoleArguments::s_ConsumeArg(_Inout_ std::vector<std::wstring>& args, _In
|
||||
// args: A collection of wstrings representing command-line arguments
|
||||
// index: the index of the argument of which to get the value for. The value
|
||||
// should be at (index+1). index will be decremented by one on success.
|
||||
// pSetting: recieves the string at index+1
|
||||
// pSetting: receives the string at index+1
|
||||
// Return Value:
|
||||
// S_OK if we parsed the string successfully, otherwise E_INVALIDARG indicating
|
||||
// failure.
|
||||
@ -132,7 +132,7 @@ HRESULT ConsoleArguments::s_GetArgumentValue(_Inout_ std::vector<std::wstring>&
|
||||
// args: A collection of wstrings representing command-line arguments
|
||||
// index: the index of the argument of which to get the value for. The value
|
||||
// should be at (index+1). index will be decremented by one on success.
|
||||
// pSetting: recieves the string at index+1
|
||||
// pSetting: receives the string at index+1
|
||||
// Return Value:
|
||||
// S_OK if we parsed the string successfully, otherwise E_INVALIDARG indicating
|
||||
// failure.
|
||||
@ -163,7 +163,7 @@ HRESULT ConsoleArguments::s_HandleFeatureValue(_Inout_ std::vector<std::wstring>
|
||||
// args: A collection of wstrings representing command-line arguments
|
||||
// index: the index of the argument of which to get the value for. The value
|
||||
// should be at (index+1). index will be decremented by one on success.
|
||||
// pSetting: recieves the short at index+1
|
||||
// pSetting: receives the short at index+1
|
||||
// Return Value:
|
||||
// S_OK if we parsed the short successfully, otherwise E_INVALIDARG indicating
|
||||
// failure. This could be the case for non-numeric arguments, or for >SHORT_MAX args.
|
||||
@ -420,7 +420,7 @@ HRESULT ConsoleArguments::ParseCommandline()
|
||||
}
|
||||
// TODO: handle the rest of the possible params (MSFT:13271366, MSFT:13631640)
|
||||
// TODO: handle invalid args
|
||||
// eg "conhost --foo bar" should not make the clientCommandline "--foo bar"
|
||||
// e.g. "conhost --foo bar" should not make the clientCommandline "--foo bar"
|
||||
else
|
||||
{
|
||||
// If we encounter something that doesn't match one of our other
|
||||
@ -547,7 +547,7 @@ bool ConsoleArguments::GetInheritCursor() const
|
||||
|
||||
// Method Description:
|
||||
// - Tell us to use a different size than the one parsed as the size of the
|
||||
// console. This is called by the PtySignalInputThread when it recieves a
|
||||
// console. This is called by the PtySignalInputThread when it receives a
|
||||
// resize before the first client has connected. Because there's no client,
|
||||
// there's also no buffer yet, so it has nothing to resize.
|
||||
// However, we shouldn't just discard that first resize message. Instead,
|
||||
|
||||
@ -294,7 +294,7 @@ HRESULT ApiRoutines::GetConsoleAliasWImpl(const std::wstring_view source,
|
||||
CATCH_RETURN();
|
||||
}
|
||||
|
||||
// These variables define the seperator character and the length of the string.
|
||||
// These variables define the separator character and the length of the string.
|
||||
// They will be used to as the joiner between source and target strings when returning alias data in list form.
|
||||
static std::wstring aliasesSeparator(L"=");
|
||||
|
||||
@ -325,11 +325,11 @@ HRESULT GetConsoleAliasesLengthWImplHelper(const std::wstring_view exeName,
|
||||
|
||||
size_t cchNeeded = 0;
|
||||
|
||||
// Each of the aliases will be made up of the source, a seperator, the target, then a null character.
|
||||
// Each of the aliases will be made up of the source, a separator, the target, then a null character.
|
||||
// They are of the form "Source=Target" when returned.
|
||||
size_t const cchNull = 1;
|
||||
size_t cchSeperator = aliasesSeparator.size();
|
||||
// If we're counting how much multibyte space will be needed, trial convert the seperator before we add.
|
||||
// If we're counting how much multibyte space will be needed, trial convert the separator before we add.
|
||||
if (!countInUnicode)
|
||||
{
|
||||
cchSeperator = GetALengthFromW(codepage, aliasesSeparator);
|
||||
@ -465,7 +465,7 @@ HRESULT GetConsoleAliasesWImplHelper(const std::wstring_view exeName,
|
||||
LPWSTR AliasesBufferPtrW = aliasBuffer.has_value() ? aliasBuffer.value().data() : nullptr;
|
||||
size_t cchTotalLength = 0; // accumulate the characters we need/have copied as we walk the list
|
||||
|
||||
// Each of the alises will be made up of the source, a seperator, the target, then a null character.
|
||||
// Each of the alises will be made up of the source, a separator, the target, then a null character.
|
||||
// They are of the form "Source=Target" when returned.
|
||||
size_t const cchNull = 1;
|
||||
|
||||
|
||||
@ -720,7 +720,7 @@ COORD CommandLine::_moveCursorLeftByWord(COOKED_READ_DATA& cookedReadData) noexc
|
||||
// LastWord is currently pointing to the last character
|
||||
// of the previous word, unless it backed up to the beginning
|
||||
// of the buffer.
|
||||
// Let's increment LastWord so that it points to the expeced
|
||||
// Let's increment LastWord so that it points to the expected
|
||||
// insertion point.
|
||||
++LastWord;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ struct _HSL
|
||||
|
||||
const auto diff = max - min;
|
||||
const auto sum = max + min;
|
||||
// Luminence
|
||||
// Luminance
|
||||
l = max / 255.0;
|
||||
|
||||
// Saturation
|
||||
@ -147,7 +147,7 @@ WORD Xterm256ToWindowsIndex(const size_t xtermTableEntry) noexcept
|
||||
}
|
||||
|
||||
// Function Description:
|
||||
// - Converts the value of a pair of xterm color table indicies to the legacy attr equivalent.
|
||||
// - Converts the value of a pair of xterm color table indices to the legacy attr equivalent.
|
||||
// Arguments:
|
||||
// - xtermForeground: the xterm color table foreground index
|
||||
// - xtermBackground: the xterm color table background index
|
||||
@ -190,7 +190,7 @@ bool FindTableIndex(const COLORREF Color,
|
||||
// - Get a COLORREF for the foreground component of the given legacy attributes.
|
||||
// Arguments:
|
||||
// - wLegacyAttrs - The legacy attributes to get the foreground color from.
|
||||
// - ColorTable - The array of colors to to get the color from.
|
||||
// - ColorTable - The array of colors to get the color from.
|
||||
// - cColorTable - The number of elements in ColorTable
|
||||
// Return Value:
|
||||
// - the COLORREF for the foreground component
|
||||
@ -209,7 +209,7 @@ COLORREF ForegroundColor(const WORD wLegacyAttrs,
|
||||
// - Get a COLORREF for the background component of the given legacy attributes.
|
||||
// Arguments:
|
||||
// - wLegacyAttrs - The legacy attributes to get the background color from.
|
||||
// - ColorTable - The array of colors to to get the color from.
|
||||
// - ColorTable - The array of colors to get the color from.
|
||||
// - cColorTable - The number of elements in ColorTable
|
||||
// Return Value:
|
||||
// - the COLORREF for the background component
|
||||
|
||||
@ -270,7 +270,7 @@ void CONSOLE_INFORMATION::SetTitle(const std::wstring_view newTitle)
|
||||
|
||||
// Method Description:
|
||||
// - Set the console title's prefix, and trigger a renderer update of the title.
|
||||
// This is the part of the title shuch as "Mark", "Select", or "Scroll"
|
||||
// This is the part of the title such as "Mark", "Select", or "Scroll"
|
||||
// Arguments:
|
||||
// - newTitlePrefix: The new value to use for the title prefix
|
||||
// Return Value:
|
||||
|
||||
@ -109,7 +109,7 @@ bool IsDBCSLeadByteConsole(const CHAR ch, const CPINFO * const pCPInfo)
|
||||
unsigned char const uchComparison = (unsigned char)ch;
|
||||
|
||||
int i = 0;
|
||||
// this is ok because the the array is guaranteed to have 2
|
||||
// this is ok because the array is guaranteed to have 2
|
||||
// null bytes at the end.
|
||||
while (pCPInfo->LeadByte[i])
|
||||
{
|
||||
|
||||
@ -571,7 +571,7 @@ HRESULT DoSrvPrivatePrependConsoleInput(_Inout_ InputBuffer* const pInputBuffer,
|
||||
// Arguments:
|
||||
// - pInputBuffer - the input buffer to write to. Currently unused, as
|
||||
// HandleGenericKeyEvent just gets the global input buffer, but all
|
||||
// ConGetSet API's require a input or output object.
|
||||
// ConGetSet API's require an input or output object.
|
||||
// - key - The keyevent to send to the console.
|
||||
// Return Value:
|
||||
// - HRESULT indicating success or failure
|
||||
@ -865,7 +865,7 @@ static HRESULT _ReadConsoleOutputWImplHelper(const SCREEN_INFORMATION& context,
|
||||
auto sourceIter = storageBuffer.GetCellDataAt(sourcePoint, clippedRequestRectangle);
|
||||
|
||||
// Walk through every cell of the target, advancing the buffer.
|
||||
// Validate that we always still have a valid iterator to the backgin store,
|
||||
// Validate that we always still have a valid iterator to the backing store,
|
||||
// that we always are writing inside the user's buffer (before the end)
|
||||
// and we're always targeting the user's buffer inside its original bounds.
|
||||
while (sourceIter && targetIter < targetBuffer.end())
|
||||
|
||||
@ -127,7 +127,7 @@ void ApiRoutines::GetConsoleScreenBufferInfoExImpl(const SCREEN_INFORMATION& con
|
||||
&data.dwMaximumWindowSize,
|
||||
&data.wPopupAttributes,
|
||||
data.ColorTable);
|
||||
// Callers of this function expect to recieve an exclusive rect, not an inclusive one.
|
||||
// Callers of this function expect to receive an exclusive rect, not an inclusive one.
|
||||
data.srWindow.Right += 1;
|
||||
data.srWindow.Bottom += 1;
|
||||
}
|
||||
@ -201,7 +201,7 @@ void ApiRoutines::GetNumberOfConsoleMouseButtonsImpl(ULONG& buttons) noexcept
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Retrieves information about the a known font based on index
|
||||
// - Retrieves information about a known font based on index
|
||||
// Arguments:
|
||||
// - context - The output buffer concerned
|
||||
// - index - We only accept 0 now as we don't keep a list of fonts in memory.
|
||||
@ -837,7 +837,7 @@ HRESULT ApiRoutines::ScrollConsoleScreenBufferWImpl(SCREEN_INFORMATION& context,
|
||||
// attributes, they likely wanted to use the full version of
|
||||
// our current attributes, whether that be RGB or _default_ colored.
|
||||
// This could create a scenario where someone emitted RGB with VT,
|
||||
// THEN used the API to ScrollConsoleOutput with the legacy attrs,
|
||||
// THEN used the API to ScrollConsoleOutput with the legacy attrs,
|
||||
// and DIDN'T want the RGB color. As in FillConsoleOutputAttribute,
|
||||
// this scenario is highly unlikely, and we can reasonably do this
|
||||
// on their behalf.
|
||||
@ -1439,7 +1439,7 @@ HRESULT DoSrvMoveCursorVertically(SCREEN_INFORMATION& screenInfo, const short li
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - A private API call for swaping to the alternate screen buffer. In virtual terminals, there exists both a "main"
|
||||
// - A private API call for swapping to the alternate screen buffer. In virtual terminals, there exists both a "main"
|
||||
// screen buffer and an alternate. ASBSET creates a new alternate, and switches to it. If there is an already
|
||||
// existing alternate, it is discarded.
|
||||
// Parameters:
|
||||
@ -1470,7 +1470,7 @@ void DoSrvPrivateUseMainScreenBuffer(SCREEN_INFORMATION& screenInfo)
|
||||
// Parameters:
|
||||
// <none>
|
||||
// Return value:
|
||||
// - STATUS_SUCCESS if handled successfully. Otherwise, an approriate status code indicating the error.
|
||||
// - STATUS_SUCCESS if handled successfully. Otherwise, an appropriate status code indicating the error.
|
||||
[[nodiscard]]
|
||||
NTSTATUS DoSrvPrivateHorizontalTabSet()
|
||||
{
|
||||
@ -1490,12 +1490,12 @@ NTSTATUS DoSrvPrivateHorizontalTabSet()
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - A private helper for excecuting a number of tabs.
|
||||
// - A private helper for executing a number of tabs.
|
||||
// Parameters:
|
||||
// sNumTabs - The number of tabs to execute
|
||||
// fForward - whether to tab forward or backwards
|
||||
// Return value:
|
||||
// - STATUS_SUCCESS if handled successfully. Otherwise, an approriate status code indicating the error.
|
||||
// - STATUS_SUCCESS if handled successfully. Otherwise, an appropriate status code indicating the error.
|
||||
[[nodiscard]]
|
||||
NTSTATUS DoPrivateTabHelper(const SHORT sNumTabs, _In_ bool fForward)
|
||||
{
|
||||
@ -1524,7 +1524,7 @@ NTSTATUS DoPrivateTabHelper(const SHORT sNumTabs, _In_ bool fForward)
|
||||
// Parameters:
|
||||
// - sNumTabs - The number of tabs to perform.
|
||||
// Return value:
|
||||
// - STATUS_SUCCESS if handled successfully. Otherwise, an approriate status code indicating the error.
|
||||
// - STATUS_SUCCESS if handled successfully. Otherwise, an appropriate status code indicating the error.
|
||||
[[nodiscard]]
|
||||
NTSTATUS DoSrvPrivateForwardTab(const SHORT sNumTabs)
|
||||
{
|
||||
@ -1537,7 +1537,7 @@ NTSTATUS DoSrvPrivateForwardTab(const SHORT sNumTabs)
|
||||
// Parameters:
|
||||
// - sNumTabs - The number of tabs to perform.
|
||||
// Return value:
|
||||
// - STATUS_SUCCESS if handled successfully. Otherwise, an approriate status code indicating the error.
|
||||
// - STATUS_SUCCESS if handled successfully. Otherwise, an appropriate status code indicating the error.
|
||||
[[nodiscard]]
|
||||
NTSTATUS DoSrvPrivateBackwardsTab(const SHORT sNumTabs)
|
||||
{
|
||||
@ -1548,7 +1548,7 @@ NTSTATUS DoSrvPrivateBackwardsTab(const SHORT sNumTabs)
|
||||
// - A private API call for clearing the VT tabs that have been set.
|
||||
// Parameters:
|
||||
// - fClearAll - If false, only clears the tab in the current column (if it exists)
|
||||
// otherwise clears all set tabs. (and reverts to lecacy 8-char tabs behavior.)
|
||||
// otherwise clears all set tabs. (and reverts to legacy 8-char tabs behavior.)
|
||||
// Return value:
|
||||
// - None
|
||||
void DoSrvPrivateTabClear(const bool fClearAll)
|
||||
@ -2046,7 +2046,7 @@ NTSTATUS DoSrvPrivateSuppressResizeRepaint()
|
||||
// Routine Description:
|
||||
// - An API call for checking if the console host is acting as a pty.
|
||||
// Parameters:
|
||||
// - isPty: recieves the bool indicating whether or not we're in pty mode.
|
||||
// - isPty: receives the bool indicating whether or not we're in pty mode.
|
||||
// Return value:
|
||||
// <none>
|
||||
void DoSrvIsConsolePty(_Out_ bool* const pIsPty)
|
||||
@ -2145,7 +2145,7 @@ void DoSrvPrivateMoveToBottom(SCREEN_INFORMATION& screenInfo)
|
||||
// Return Value:
|
||||
// - E_INVALIDARG if index is >= 256, else S_OK
|
||||
// Notes:
|
||||
// Does not take a buffer paramenter. The color table for a console and for
|
||||
// Does not take a buffer parameter. The color table for a console and for
|
||||
// terminals as well is global, not per-screen-buffer.
|
||||
[[nodiscard]]
|
||||
HRESULT DoSrvPrivateSetColorTableEntry(const short index, const COLORREF value) noexcept
|
||||
|
||||
@ -760,7 +760,7 @@ HRESULT ApiRoutines::GetConsoleCommandHistoryLengthWImpl(const std::wstring_view
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Retrieves a the full command history for a given EXE name known to the console.
|
||||
// - Retrieves the full command history for a given EXE name known to the console.
|
||||
// - It is permitted to call this function without having a target buffer. Use the result to allocate
|
||||
// the appropriate amount of space and call again.
|
||||
// - This behavior exists to allow the A version of the function to help allocate the right temp buffer for conversion of
|
||||
@ -835,7 +835,7 @@ HRESULT GetConsoleCommandHistoryWImplHelper(const std::wstring_view exeName,
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Retrieves a the full command history for a given EXE name known to the console.
|
||||
// - Retrieves the full command history for a given EXE name known to the console.
|
||||
// - Converts inputs from A to W, calls the W version of this method, and then converts the resulting text W to A.
|
||||
// Arguments:
|
||||
// - exeName - The client EXE application attached to the host whose set we should check
|
||||
@ -899,7 +899,7 @@ HRESULT ApiRoutines::GetConsoleCommandHistoryAImpl(const std::string_view exeNam
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Retrieves a the full command history for a given EXE name known to the console.
|
||||
// - Retrieves the full command history for a given EXE name known to the console.
|
||||
// - Converts inputs from A to W, calls the W version of this method, and then converts the resulting text W to A.
|
||||
// Arguments:
|
||||
// - exeName - The client EXE application attached to the host whose set we should check
|
||||
|
||||
@ -338,7 +338,7 @@ NTSTATUS InteractivityFactory::CreateInputServices(_Inout_ std::unique_ptr<IInpu
|
||||
// function is used to create an invisible window for that scenario, so
|
||||
// that GetConsoleWindow returns a real value.
|
||||
// Arguments:
|
||||
// - hwnd: Recieves the value of the newly created window's HWND.
|
||||
// - hwnd: Receives the value of the newly created window's HWND.
|
||||
// Return Value:
|
||||
// - STATUS_SUCCESS on success, otherwise an appropriate error.
|
||||
[[nodiscard]]
|
||||
|
||||
@ -55,7 +55,7 @@ void ServiceLocator::RundownAndExit(const HRESULT hr)
|
||||
// This rundown happens before the final destruction of any outstanding handles or resources.
|
||||
// If someone is waiting on one of those handles or resources outside our process, they're stuck waiting
|
||||
// for our terminate rundown and can't continue execution until we're done.
|
||||
// We don't want to have other execution in the system get stuck , so this is a great
|
||||
// We don't want to have other execution in the system get stuck, so this is a great
|
||||
// place to clean up and notify any objects or threads in the system that have to cleanup safely before
|
||||
// we head into TerminateProcess and tear everything else down less gracefully.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user