diff --git a/src/cascadia/LocalTests_SettingsModel/SerializationTests.cpp b/src/cascadia/LocalTests_SettingsModel/SerializationTests.cpp index 10214b861..ff2aefdb6 100644 --- a/src/cascadia/LocalTests_SettingsModel/SerializationTests.cpp +++ b/src/cascadia/LocalTests_SettingsModel/SerializationTests.cpp @@ -97,6 +97,7 @@ namespace SettingsModelLocalTests "confirmCloseAllTabs": true, "largePasteWarning": true, "multiLinePasteWarning": true, + "trimPaste": true, "experimental.input.forceVT": false, "experimental.rendering.forceFullRepaint": false, diff --git a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp index 02025be81..6a1a8282c 100644 --- a/src/cascadia/PublicTerminalCore/HwndTerminal.cpp +++ b/src/cascadia/PublicTerminalCore/HwndTerminal.cpp @@ -977,7 +977,7 @@ void HwndTerminal::_StringPaste(const wchar_t* const pData) noexcept CATCH_LOG(); } -COORD HwndTerminal::GetFontSize() const +COORD HwndTerminal::GetFontSize() const noexcept { return _actualFont.GetSize(); } diff --git a/src/cascadia/PublicTerminalCore/HwndTerminal.hpp b/src/cascadia/PublicTerminalCore/HwndTerminal.hpp index bc9c8ba4a..0510675ef 100644 --- a/src/cascadia/PublicTerminalCore/HwndTerminal.hpp +++ b/src/cascadia/PublicTerminalCore/HwndTerminal.hpp @@ -128,7 +128,7 @@ private: void _SendCharEvent(wchar_t ch, WORD scanCode, WORD flags) noexcept; // Inherited via IControlAccessibilityInfo - COORD GetFontSize() const override; + COORD GetFontSize() const noexcept override; RECT GetBounds() const noexcept override; double GetScaleFactor() const noexcept override; void ChangeViewport(const SMALL_RECT NewWindow) override; diff --git a/src/cascadia/TerminalApp/AppActionHandlers.cpp b/src/cascadia/TerminalApp/AppActionHandlers.cpp index ae79289fa..d9d4a1ca1 100644 --- a/src/cascadia/TerminalApp/AppActionHandlers.cpp +++ b/src/cascadia/TerminalApp/AppActionHandlers.cpp @@ -556,7 +556,7 @@ namespace winrt::TerminalApp::implementation auto actions = winrt::single_threaded_vector(std::move( TerminalPage::ConvertExecuteCommandlineToActions(realArgs))); - if (_startupActions.Size() != 0) + if (actions.Size() != 0) { actionArgs.Handled(true); ProcessStartupActions(actions, false); diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 9523a3a37..4e6910903 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -1594,7 +1594,10 @@ namespace winrt::TerminalApp::implementation // the control here instead. if (_startupState == StartupState::Initialized) { - _GetActiveControl().Focus(FocusState::Programmatic); + if (const auto control = _GetActiveControl()) + { + control.Focus(FocusState::Programmatic); + } } } CATCH_LOG(); @@ -1866,6 +1869,22 @@ namespace winrt::TerminalApp::implementation } } + if (_settings.GlobalSettings().TrimPaste()) + { + std::wstring_view textView{ text }; + const auto pos = textView.find_last_not_of(L"\t\n\v\f\r "); + if (pos == textView.npos) + { + // Text is all white space, nothing to paste + co_return; + } + else if (const auto toRemove = textView.size() - 1 - pos; toRemove > 0) + { + textView.remove_suffix(toRemove); + text = { textView }; + } + } + bool warnMultiLine = _settings.GlobalSettings().WarnAboutMultiLinePaste(); if (warnMultiLine) { diff --git a/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp b/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp index e34811e73..570cfd67e 100644 --- a/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp +++ b/src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp @@ -141,12 +141,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation #pragma endregion #pragma region IControlAccessibilityInfo - COORD InteractivityAutomationPeer::GetFontSize() const + COORD InteractivityAutomationPeer::GetFontSize() const noexcept { return til::size{ til::math::rounding, _interactivity->Core().FontSize() }; } - RECT InteractivityAutomationPeer::GetBounds() const + RECT InteractivityAutomationPeer::GetBounds() const noexcept { return _controlBounds; } @@ -159,12 +159,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation return S_OK; } - RECT InteractivityAutomationPeer::GetPadding() const + RECT InteractivityAutomationPeer::GetPadding() const noexcept { return _controlPadding; } - double InteractivityAutomationPeer::GetScaleFactor() const + double InteractivityAutomationPeer::GetScaleFactor() const noexcept { return DisplayInformation::GetForCurrentView().RawPixelsPerViewPixel(); } diff --git a/src/cascadia/TerminalControl/InteractivityAutomationPeer.h b/src/cascadia/TerminalControl/InteractivityAutomationPeer.h index 144ea20ef..bd95c5404 100644 --- a/src/cascadia/TerminalControl/InteractivityAutomationPeer.h +++ b/src/cascadia/TerminalControl/InteractivityAutomationPeer.h @@ -62,10 +62,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation #pragma region IControlAccessibilityInfo Pattern // Inherited via IControlAccessibilityInfo - virtual COORD GetFontSize() const override; - virtual RECT GetBounds() const override; - virtual RECT GetPadding() const override; - virtual double GetScaleFactor() const override; + virtual COORD GetFontSize() const noexcept override; + virtual RECT GetBounds() const noexcept override; + virtual RECT GetPadding() const noexcept override; + virtual double GetScaleFactor() const noexcept override; virtual void ChangeViewport(SMALL_RECT NewWindow) override; virtual HRESULT GetHostUiaProvider(IRawElementProviderSimple** provider) override; #pragma endregion diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.xaml b/src/cascadia/TerminalSettingsEditor/Interaction.xaml index 6b93c5847..8bdf829f6 100644 --- a/src/cascadia/TerminalSettingsEditor/Interaction.xaml +++ b/src/cascadia/TerminalSettingsEditor/Interaction.xaml @@ -45,6 +45,11 @@ + + + + + + REGISTER_PROXY_DLL;WIN32;%(PreprocessorDefinitions) NotUsing + Default false false nodefaultlib_shim.h;%(ForcedIncludeFiles) diff --git a/src/host/proxy/nodefaultlib_shim.h b/src/host/proxy/nodefaultlib_shim.h index 09c0ad53c..4face4e49 100644 --- a/src/host/proxy/nodefaultlib_shim.h +++ b/src/host/proxy/nodefaultlib_shim.h @@ -1,18 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +#pragma once + #include -#if !defined(_M_IX86) && !defined(_M_X64) - -// ARM64 doesn't define a (__builtin_)memcmp function without CRT, -// but we need one to compile IID_GENERIC_CHECK_IID. -// Luckily we only ever use memcmp for IIDs. -#pragma function(memcmp) -inline int memcmp(const IID* a, const IID* b, size_t count) -{ - (void)(count); - return 1 - InlineIsEqualGUID(a, b); -} - -#endif +#define memcmp(a, b, c) (!InlineIsEqualGUID(a, b)) diff --git a/src/host/selection.cpp b/src/host/selection.cpp index 7814bfae9..90bb5668f 100644 --- a/src/host/selection.cpp +++ b/src/host/selection.cpp @@ -255,6 +255,14 @@ void Selection::ExtendSelection(_In_ COORD coordBufferPos) srNewSelection.Top = _coordSelectionAnchor.Y; } + // This function is called on WM_MOUSEMOVE. + // Prevent triggering an invalidation just because the mouse moved + // in the same cell without changing the actual (visible) selection. + if (_srSelectionRect == srNewSelection) + { + return; + } + // call special update method to modify the displayed selection in-place // NOTE: Using HideSelection, editing the rectangle, then ShowSelection will cause flicker. //_PaintUpdateSelection(&srNewSelection); diff --git a/src/renderer/base/FontInfoBase.cpp b/src/renderer/base/FontInfoBase.cpp index 40891cf49..c95abf08d 100644 --- a/src/renderer/base/FontInfoBase.cpp +++ b/src/renderer/base/FontInfoBase.cpp @@ -7,20 +7,11 @@ #include "../inc/FontInfoBase.hpp" -bool operator==(const FontInfoBase& a, const FontInfoBase& b) -{ - return a._faceName == b._faceName && - a._weight == b._weight && - a._family == b._family && - a._codePage == b._codePage && - a._fDefaultRasterSetFromEngine == b._fDefaultRasterSetFromEngine; -} - -FontInfoBase::FontInfoBase(const std::wstring_view faceName, +FontInfoBase::FontInfoBase(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const bool fSetDefaultRasterFont, - const unsigned int codePage) : + const unsigned int codePage) noexcept : _faceName(faceName), _family(family), _weight(weight), @@ -30,20 +21,16 @@ FontInfoBase::FontInfoBase(const std::wstring_view faceName, ValidateFont(); } -FontInfoBase::FontInfoBase(const FontInfoBase& fibFont) : - FontInfoBase(fibFont.GetFaceName(), - fibFont.GetFamily(), - fibFont.GetWeight(), - fibFont.WasDefaultRasterSetFromEngine(), - fibFont.GetCodePage()) +bool FontInfoBase::operator==(const FontInfoBase& other) noexcept { + return _faceName == other._faceName && + _weight == other._weight && + _family == other._family && + _codePage == other._codePage && + _fDefaultRasterSetFromEngine == other._fDefaultRasterSetFromEngine; } -FontInfoBase::~FontInfoBase() -{ -} - -unsigned char FontInfoBase::GetFamily() const +unsigned char FontInfoBase::GetFamily() const noexcept { return _family; } @@ -51,22 +38,22 @@ unsigned char FontInfoBase::GetFamily() const // When the default raster font is forced set from the engine, this is how we differentiate it from a simple apply. // Default raster font is internally represented as a blank face name and zeros for weight, family, and size. This is // the hint for the engine to use whatever comes back from GetStockObject(OEM_FIXED_FONT) (at least in the GDI world). -bool FontInfoBase::WasDefaultRasterSetFromEngine() const +bool FontInfoBase::WasDefaultRasterSetFromEngine() const noexcept { return _fDefaultRasterSetFromEngine; } -unsigned int FontInfoBase::GetWeight() const +unsigned int FontInfoBase::GetWeight() const noexcept { return _weight; } -const std::wstring_view FontInfoBase::GetFaceName() const noexcept +const std::wstring& FontInfoBase::GetFaceName() const noexcept { return _faceName; } -unsigned int FontInfoBase::GetCodePage() const +unsigned int FontInfoBase::GetCodePage() const noexcept { return _codePage; } @@ -77,21 +64,18 @@ unsigned int FontInfoBase::GetCodePage() const // Arguments: // - buffer: the buffer into which to copy characters // - size: the size of buffer -HRESULT FontInfoBase::FillLegacyNameBuffer(gsl::span buffer) const -try +void FontInfoBase::FillLegacyNameBuffer(wchar_t (&buffer)[LF_FACESIZE]) const noexcept { - auto toCopy = std::min(buffer.size() - 1, _faceName.size()); - auto last = std::copy(_faceName.cbegin(), _faceName.cbegin() + toCopy, buffer.begin()); - std::fill(last, buffer.end(), L'\0'); - return S_OK; + const auto toCopy = std::min(std::size(buffer) - 1, _faceName.size()); + const auto last = std::copy_n(_faceName.data(), toCopy, &buffer[0]); + *last = L'\0'; } -CATCH_RETURN(); // NOTE: this method is intended to only be used from the engine itself to respond what font it has chosen. -void FontInfoBase::SetFromEngine(const std::wstring_view faceName, +void FontInfoBase::SetFromEngine(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, - const bool fSetDefaultRasterFont) + const bool fSetDefaultRasterFont) noexcept { _faceName = faceName; _family = family; @@ -101,12 +85,12 @@ void FontInfoBase::SetFromEngine(const std::wstring_view faceName, // Internally, default raster font is represented by empty facename, and zeros for weight, family, and size. Since // FontInfoBase doesn't have sizing information, this helper checks everything else. -bool FontInfoBase::IsDefaultRasterFontNoSize() const +bool FontInfoBase::IsDefaultRasterFontNoSize() const noexcept { return (_weight == 0 && _family == 0 && _faceName.empty()); } -void FontInfoBase::ValidateFont() +void FontInfoBase::ValidateFont() noexcept { // If we were given a blank name, it meant raster fonts, which to us is always Terminal. if (!IsDefaultRasterFontNoSize() && s_pFontDefaultList != nullptr) @@ -128,14 +112,14 @@ void FontInfoBase::ValidateFont() } } -bool FontInfoBase::IsTrueTypeFont() const +bool FontInfoBase::IsTrueTypeFont() const noexcept { return WI_IsFlagSet(_family, TMPF_TRUETYPE); } Microsoft::Console::Render::IFontDefaultList* FontInfoBase::s_pFontDefaultList; -void FontInfoBase::s_SetFontDefaultList(_In_ Microsoft::Console::Render::IFontDefaultList* const pFontDefaultList) +void FontInfoBase::s_SetFontDefaultList(_In_ Microsoft::Console::Render::IFontDefaultList* const pFontDefaultList) noexcept { s_pFontDefaultList = pFontDefaultList; } diff --git a/src/renderer/base/FontInfoDesired.cpp b/src/renderer/base/FontInfoDesired.cpp index c293d141a..900648ad6 100644 --- a/src/renderer/base/FontInfoDesired.cpp +++ b/src/renderer/base/FontInfoDesired.cpp @@ -5,13 +5,29 @@ #include "../inc/FontInfoDesired.hpp" -bool operator==(const FontInfoDesired& a, const FontInfoDesired& b) +FontInfoDesired::FontInfoDesired(const std::wstring_view& faceName, + const unsigned char family, + const unsigned int weight, + const COORD coordSizeDesired, + const unsigned int codePage) noexcept : + FontInfoBase(faceName, family, weight, false, codePage), + _coordSizeDesired(coordSizeDesired) { - return (static_cast(a) == static_cast(b) && - a._coordSizeDesired == b._coordSizeDesired); } -COORD FontInfoDesired::GetEngineSize() const +FontInfoDesired::FontInfoDesired(const FontInfo& fiFont) noexcept : + FontInfoBase(fiFont), + _coordSizeDesired(fiFont.GetUnscaledSize()) +{ +} + +bool FontInfoDesired::operator==(const FontInfoDesired& other) noexcept +{ + return FontInfoBase::operator==(other) && + _coordSizeDesired == other._coordSizeDesired; +} + +COORD FontInfoDesired::GetEngineSize() const noexcept { COORD coordSize = _coordSizeDesired; if (IsTrueTypeFont()) @@ -22,30 +38,14 @@ COORD FontInfoDesired::GetEngineSize() const return coordSize; } -FontInfoDesired::FontInfoDesired(const std::wstring_view faceName, - const unsigned char family, - const unsigned int weight, - const COORD coordSizeDesired, - const unsigned int codePage) : - FontInfoBase(faceName, family, weight, false, codePage), - _coordSizeDesired(coordSizeDesired) -{ -} - -FontInfoDesired::FontInfoDesired(const FontInfo& fiFont) : - FontInfoBase(fiFont), - _coordSizeDesired(fiFont.GetUnscaledSize()) -{ -} - // This helper determines if this object represents the default raster font. This can either be because internally we're // using the empty facename and zeros for size, weight, and family, or it can be because we were given explicit // dimensions from the engine that were the result of loading the default raster font. See GdiEngine::_GetProposedFont(). -bool FontInfoDesired::IsDefaultRasterFont() const +bool FontInfoDesired::IsDefaultRasterFont() const noexcept { // Either the raster was set from the engine... // OR the face name is empty with a size of 0x0 or 8x12. return WasDefaultRasterSetFromEngine() || (GetFaceName().empty() && - ((_coordSizeDesired.X == 0 && _coordSizeDesired.Y == 0) || - (_coordSizeDesired.X == 8 && _coordSizeDesired.Y == 12))); + (_coordSizeDesired == COORD{ 0, 0 } || + _coordSizeDesired == COORD{ 8, 12 })); } diff --git a/src/renderer/base/fontinfo.cpp b/src/renderer/base/fontinfo.cpp index ef3c37e8c..c73326c08 100644 --- a/src/renderer/base/fontinfo.cpp +++ b/src/renderer/base/fontinfo.cpp @@ -5,19 +5,12 @@ #include "../inc/FontInfo.hpp" -bool operator==(const FontInfo& a, const FontInfo& b) -{ - return (static_cast(a) == static_cast(b) && - a._coordSize == b._coordSize && - a._coordSizeUnscaled == b._coordSizeUnscaled); -} - -FontInfo::FontInfo(const std::wstring_view faceName, +FontInfo::FontInfo(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const COORD coordSize, const unsigned int codePage, - const bool fSetDefaultRasterFont /* = false */) : + const bool fSetDefaultRasterFont /* = false */) noexcept : FontInfoBase(faceName, family, weight, fSetDefaultRasterFont, codePage), _coordSize(coordSize), _coordSizeUnscaled(coordSize), @@ -26,38 +19,36 @@ FontInfo::FontInfo(const std::wstring_view faceName, ValidateFont(); } -FontInfo::FontInfo(const FontInfo& fiFont) : - FontInfoBase(fiFont), - _coordSize(fiFont.GetSize()), - _coordSizeUnscaled(fiFont.GetUnscaledSize()) +bool FontInfo::operator==(const FontInfo& other) noexcept { + return FontInfoBase::operator==(other) && + _coordSize == other._coordSize && + _coordSizeUnscaled == other._coordSizeUnscaled; } -COORD FontInfo::GetUnscaledSize() const +COORD FontInfo::GetUnscaledSize() const noexcept { return _coordSizeUnscaled; } -COORD FontInfo::GetSize() const +COORD FontInfo::GetSize() const noexcept { return _coordSize; } -void FontInfo::SetFromEngine(const std::wstring_view faceName, +void FontInfo::SetFromEngine(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const bool fSetDefaultRasterFont, const COORD coordSize, - const COORD coordSizeUnscaled) + const COORD coordSizeUnscaled) noexcept { FontInfoBase::SetFromEngine(faceName, family, weight, fSetDefaultRasterFont); - _coordSize = coordSize; _coordSizeUnscaled = coordSizeUnscaled; - _ValidateCoordSize(); } @@ -71,12 +62,12 @@ void FontInfo::SetFallback(const bool didFallback) noexcept _didFallback = didFallback; } -void FontInfo::ValidateFont() +void FontInfo::ValidateFont() noexcept { _ValidateCoordSize(); } -void FontInfo::_ValidateCoordSize() +void FontInfo::_ValidateCoordSize() noexcept { // a (0,0) font is okay for the default raster font, as we will eventually set the dimensions based on the font GDI // passes back to us. diff --git a/src/renderer/gdi/state.cpp b/src/renderer/gdi/state.cpp index 04a5df7d5..722577c8e 100644 --- a/src/renderer/gdi/state.cpp +++ b/src/renderer/gdi/state.cpp @@ -610,7 +610,7 @@ GdiEngine::~GdiEngine() // NOTE: not using what GDI gave us because some fonts don't quite roundtrip (e.g. MS Gothic and VL Gothic) lf.lfPitchAndFamily = (FIXED_PITCH | FF_MODERN); - RETURN_IF_FAILED(FontDesired.FillLegacyNameBuffer(gsl::make_span(lf.lfFaceName))); + FontDesired.FillLegacyNameBuffer(lf.lfFaceName); // Create font. hFont.reset(CreateFontIndirectW(&lf)); diff --git a/src/renderer/inc/FontInfo.hpp b/src/renderer/inc/FontInfo.hpp index 56065881e..2b5ee3564 100644 --- a/src/renderer/inc/FontInfo.hpp +++ b/src/renderer/inc/FontInfo.hpp @@ -28,40 +28,31 @@ Author(s): class FontInfo : public FontInfoBase { public: - FontInfo(const std::wstring_view faceName, + FontInfo(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const COORD coordSize, const unsigned int codePage, - const bool fSetDefaultRasterFont = false); + const bool fSetDefaultRasterFont = false) noexcept; - FontInfo(const FontInfo& fiFont); + bool operator==(const FontInfo& other) noexcept; - COORD GetSize() const; - COORD GetUnscaledSize() const; - - void SetFromEngine(const std::wstring_view faceName, + COORD GetSize() const noexcept; + COORD GetUnscaledSize() const noexcept; + void SetFromEngine(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const bool fSetDefaultRasterFont, const COORD coordSize, - const COORD coordSizeUnscaled); - + const COORD coordSizeUnscaled) noexcept; bool GetFallback() const noexcept; void SetFallback(const bool didFallback) noexcept; - - void ValidateFont(); - - friend bool operator==(const FontInfo& a, const FontInfo& b); + void ValidateFont() noexcept; private: - void _ValidateCoordSize(); + void _ValidateCoordSize() noexcept; COORD _coordSize; COORD _coordSizeUnscaled; bool _didFallback; }; - -bool operator==(const FontInfo& a, const FontInfo& b); - -// SET AND UNSET CONSOLE_OEMFONT_DISPLAY unless we can get rid of the stupid recoding in the conhost side. diff --git a/src/renderer/inc/FontInfoBase.hpp b/src/renderer/inc/FontInfoBase.hpp index aa9f3cddb..2ef5478f8 100644 --- a/src/renderer/inc/FontInfoBase.hpp +++ b/src/renderer/inc/FontInfoBase.hpp @@ -26,40 +26,32 @@ static constexpr wchar_t DEFAULT_RASTER_FONT_FACENAME[]{ L"Terminal" }; class FontInfoBase { public: - FontInfoBase(const std::wstring_view faceName, + FontInfoBase(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const bool fSetDefaultRasterFont, - const unsigned int uiCodePage); + const unsigned int uiCodePage) noexcept; - FontInfoBase(const FontInfoBase& fibFont); + bool operator==(const FontInfoBase& other) noexcept; - ~FontInfoBase(); - - unsigned char GetFamily() const; - unsigned int GetWeight() const; - const std::wstring_view GetFaceName() const noexcept; - unsigned int GetCodePage() const; - - HRESULT FillLegacyNameBuffer(gsl::span buffer) const; - - bool IsTrueTypeFont() const; - - void SetFromEngine(const std::wstring_view faceName, + unsigned char GetFamily() const noexcept; + unsigned int GetWeight() const noexcept; + const std::wstring& GetFaceName() const noexcept; + unsigned int GetCodePage() const noexcept; + void FillLegacyNameBuffer(wchar_t (&buffer)[LF_FACESIZE]) const noexcept; + bool IsTrueTypeFont() const noexcept; + void SetFromEngine(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, - const bool fSetDefaultRasterFont); - - bool WasDefaultRasterSetFromEngine() const; - void ValidateFont(); + const bool fSetDefaultRasterFont) noexcept; + bool WasDefaultRasterSetFromEngine() const noexcept; + void ValidateFont() noexcept; static Microsoft::Console::Render::IFontDefaultList* s_pFontDefaultList; - static void s_SetFontDefaultList(_In_ Microsoft::Console::Render::IFontDefaultList* const pFontDefaultList); - - friend bool operator==(const FontInfoBase& a, const FontInfoBase& b); + static void s_SetFontDefaultList(_In_ Microsoft::Console::Render::IFontDefaultList* const pFontDefaultList) noexcept; protected: - bool IsDefaultRasterFontNoSize() const; + bool IsDefaultRasterFontNoSize() const noexcept; private: std::wstring _faceName; @@ -68,5 +60,3 @@ private: unsigned int _codePage; bool _fDefaultRasterSetFromEngine; }; - -bool operator==(const FontInfoBase& a, const FontInfoBase& b); diff --git a/src/renderer/inc/FontInfoDesired.hpp b/src/renderer/inc/FontInfoDesired.hpp index a680f1856..44e585819 100644 --- a/src/renderer/inc/FontInfoDesired.hpp +++ b/src/renderer/inc/FontInfoDesired.hpp @@ -24,21 +24,18 @@ Author(s): class FontInfoDesired : public FontInfoBase { public: - FontInfoDesired(const std::wstring_view faceName, + FontInfoDesired(const std::wstring_view& faceName, const unsigned char family, const unsigned int weight, const COORD coordSizeDesired, - const unsigned int uiCodePage); + const unsigned int uiCodePage) noexcept; + FontInfoDesired(const FontInfo& fiFont) noexcept; - FontInfoDesired(const FontInfo& fiFont); + bool operator==(const FontInfoDesired& other) noexcept; - COORD GetEngineSize() const; - bool IsDefaultRasterFont() const; - - friend bool operator==(const FontInfoDesired& a, const FontInfoDesired& b); + COORD GetEngineSize() const noexcept; + bool IsDefaultRasterFont() const noexcept; private: COORD _coordSizeDesired; }; - -bool operator==(const FontInfoDesired& a, const FontInfoDesired& b); diff --git a/src/types/IControlAccessibilityInfo.h b/src/types/IControlAccessibilityInfo.h index b20f96569..de3a3eeec 100644 --- a/src/types/IControlAccessibilityInfo.h +++ b/src/types/IControlAccessibilityInfo.h @@ -24,10 +24,10 @@ namespace Microsoft::Console::Types public: virtual ~IControlAccessibilityInfo() = 0; - virtual COORD GetFontSize() const = 0; - virtual RECT GetBounds() const = 0; - virtual RECT GetPadding() const = 0; - virtual double GetScaleFactor() const = 0; + virtual COORD GetFontSize() const noexcept = 0; + virtual RECT GetBounds() const noexcept = 0; + virtual RECT GetPadding() const noexcept = 0; + virtual double GetScaleFactor() const noexcept = 0; virtual void ChangeViewport(const SMALL_RECT NewWindow) = 0; virtual HRESULT GetHostUiaProvider(IRawElementProviderSimple** provider) = 0; @@ -40,4 +40,4 @@ namespace Microsoft::Console::Types }; inline IControlAccessibilityInfo::~IControlAccessibilityInfo() {} -} \ No newline at end of file +} diff --git a/src/types/TermControlUiaProvider.cpp b/src/types/TermControlUiaProvider.cpp index edcee5a15..2d96fa44b 100644 --- a/src/types/TermControlUiaProvider.cpp +++ b/src/types/TermControlUiaProvider.cpp @@ -44,7 +44,7 @@ IFACEMETHODIMP TermControlUiaProvider::Navigate(_In_ NavigateDirection direction return S_OK; } -IFACEMETHODIMP TermControlUiaProvider::get_BoundingRectangle(_Out_ UiaRect* pRect) +IFACEMETHODIMP TermControlUiaProvider::get_BoundingRectangle(_Out_ UiaRect* pRect) noexcept { // TODO GitHub #1914: Re-attach Tracing to UIA Tree //Tracing::s_TraceUia(this, ApiCall::GetBoundingRectangle, nullptr); @@ -89,17 +89,17 @@ IFACEMETHODIMP TermControlUiaProvider::get_FragmentRoot(_COM_Outptr_result_maybe return S_OK; } -const COORD TermControlUiaProvider::GetFontSize() const +const COORD TermControlUiaProvider::GetFontSize() const noexcept { return _controlInfo->GetFontSize(); } -const RECT TermControlUiaProvider::GetPadding() const +const RECT TermControlUiaProvider::GetPadding() const noexcept { return _controlInfo->GetPadding(); } -const double TermControlUiaProvider::GetScaleFactor() const +const double TermControlUiaProvider::GetScaleFactor() const noexcept { return _controlInfo->GetScaleFactor(); } diff --git a/src/types/TermControlUiaProvider.hpp b/src/types/TermControlUiaProvider.hpp index a7629ea08..4e2131267 100644 --- a/src/types/TermControlUiaProvider.hpp +++ b/src/types/TermControlUiaProvider.hpp @@ -36,12 +36,12 @@ namespace Microsoft::Terminal IFACEMETHODIMP Navigate(_In_ NavigateDirection direction, _COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider) noexcept override; IFACEMETHODIMP get_HostRawElementProvider(IRawElementProviderSimple** ppProvider) noexcept override; - IFACEMETHODIMP get_BoundingRectangle(_Out_ UiaRect* pRect) override; + IFACEMETHODIMP get_BoundingRectangle(_Out_ UiaRect* pRect) noexcept override; IFACEMETHODIMP get_FragmentRoot(_COM_Outptr_result_maybenull_ IRawElementProviderFragmentRoot** ppProvider) noexcept override; - const COORD GetFontSize() const; - const RECT GetPadding() const; - const double GetScaleFactor() const; + const COORD GetFontSize() const noexcept; + const RECT GetPadding() const noexcept; + const double GetScaleFactor() const noexcept; void ChangeViewport(const SMALL_RECT NewWindow) override; protected: diff --git a/src/types/TermControlUiaTextRange.cpp b/src/types/TermControlUiaTextRange.cpp index 5d95dbd88..97a5ca41f 100644 --- a/src/types/TermControlUiaTextRange.cpp +++ b/src/types/TermControlUiaTextRange.cpp @@ -134,7 +134,7 @@ void TermControlUiaTextRange::_TranslatePointFromScreen(LPPOINT screenPoint) con screenPoint->y = includeOffsets(screenPoint->y, boundingRect.top, padding.top, scaleFactor); } -const COORD TermControlUiaTextRange::_getScreenFontSize() const +const COORD TermControlUiaTextRange::_getScreenFontSize() const noexcept { // Do NOT get the font info from IRenderData. It is a dummy font info. // Instead, the font info is saved in the TermControl. So we have to diff --git a/src/types/TermControlUiaTextRange.hpp b/src/types/TermControlUiaTextRange.hpp index 4ec34277a..42afc210b 100644 --- a/src/types/TermControlUiaTextRange.hpp +++ b/src/types/TermControlUiaTextRange.hpp @@ -57,6 +57,6 @@ namespace Microsoft::Terminal protected: void _TranslatePointToScreen(LPPOINT clientPoint) const override; void _TranslatePointFromScreen(LPPOINT screenPoint) const override; - const COORD _getScreenFontSize() const override; + const COORD _getScreenFontSize() const noexcept override; }; } diff --git a/src/types/UiaTextRangeBase.cpp b/src/types/UiaTextRangeBase.cpp index c32a6a900..2bc7411d9 100644 --- a/src/types/UiaTextRangeBase.cpp +++ b/src/types/UiaTextRangeBase.cpp @@ -1313,7 +1313,7 @@ IFACEMETHODIMP UiaTextRangeBase::GetChildren(_Outptr_result_maybenull_ SAFEARRAY #pragma endregion -const COORD UiaTextRangeBase::_getScreenFontSize() const +const COORD UiaTextRangeBase::_getScreenFontSize() const noexcept { COORD coordRet = _pData->GetFontInfo().GetSize(); diff --git a/src/types/UiaTextRangeBase.hpp b/src/types/UiaTextRangeBase.hpp index 24756648f..c9089438d 100644 --- a/src/types/UiaTextRangeBase.hpp +++ b/src/types/UiaTextRangeBase.hpp @@ -146,7 +146,7 @@ namespace Microsoft::Console::Types RECT _getTerminalRect() const; - virtual const COORD _getScreenFontSize() const; + virtual const COORD _getScreenFontSize() const noexcept; const unsigned int _getViewportHeight(const SMALL_RECT viewport) const noexcept; const Viewport _getOptimizedBufferSize() const noexcept;