Merge remote-tracking branch 'origin/main' into feature/llm

This commit is contained in:
Console Service Bot 2025-08-21 01:31:38 +00:00
commit aa1f3ef91e
13 changed files with 38 additions and 27 deletions

View File

@ -1161,10 +1161,12 @@ void Pane::SetActive()
// focused, else the profile of the last control to be focused
Profile Pane::GetFocusedProfile()
{
auto lastFocused = GetActivePane();
if (const auto& terminalPane{ lastFocused->_getTerminalContent() })
if (auto lastFocused{ GetActivePane() })
{
return terminalPane.GetProfile();
if (const auto& terminalPane{ lastFocused->_getTerminalContent() })
{
return terminalPane.GetProfile();
}
}
return nullptr;
}

View File

@ -2127,9 +2127,9 @@ namespace winrt::TerminalApp::implementation
// - The value to populate in the title run of the tool tip
winrt::hstring Tab::_CreateToolTipTitle()
{
if (const auto& control{ GetActiveTerminalControl() })
if (const auto profile{ GetFocusedProfile() })
{
const auto profileName{ control.Settings().ProfileName() };
const auto profileName{ profile.Name() };
if (profileName != Title())
{
return winrt::hstring{ fmt::format(FMT_COMPILE(L"{}: {}"), profileName, Title()) };

View File

@ -38,8 +38,6 @@ namespace Microsoft.Terminal.Control
interface IControlSettings requires Microsoft.Terminal.Core.ICoreSettings,
Microsoft.Terminal.Control.IControlAppearance
{
String ProfileName;
Boolean EnableUnfocusedAcrylic { get; };
Guid SessionId { get; };
ScrollbarState ScrollState { get; };

View File

@ -2610,9 +2610,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return _core.Title();
}
hstring TermControl::GetProfileName() const
hstring TermControl::GetStartingTitle() const
{
return _core.Settings().ProfileName();
return _core.Settings().StartingTitle();
}
hstring TermControl::WorkingDirectory() const

View File

@ -58,7 +58,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
uint64_t ContentId() const;
hstring GetProfileName() const;
hstring GetStartingTitle() const;
bool CopySelectionToClipboard(bool dismissSelection, bool singleLine, bool withControlSequences, const CopyFormat formats);
void PasteTextFromClipboard();

View File

@ -308,14 +308,14 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// fall back to title if profile name is empty
if (auto control{ _termControl.get() })
{
const auto profileName = control->GetProfileName();
if (profileName.empty())
const auto originalName = control->GetStartingTitle();
if (originalName.empty())
{
return control->Title();
}
else
{
return profileName;
return originalName;
}
}

View File

@ -297,9 +297,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
_AltGrAliasing = profile.AltGrAliasing();
_AnswerbackMessage = profile.AnswerbackMessage();
// Fill in the remaining properties from the profile
_ProfileName = profile.Name();
const auto fontInfo = profile.FontInfo();
_FontFace = fontInfo.FontFace();
_FontSize = fontInfo.FontSize();

View File

@ -121,8 +121,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// ------------------------ End of Core Settings -----------------------
INHERITABLE_SETTING(Model::TerminalSettings, hstring, ProfileName);
INHERITABLE_SETTING(Model::TerminalSettings, guid, SessionId);
INHERITABLE_SETTING(Model::TerminalSettings, bool, EnableUnfocusedAcrylic, false);
INHERITABLE_SETTING(Model::TerminalSettings, bool, UseAcrylic, false);

View File

@ -60,7 +60,6 @@
// --------------------------- Control Settings ---------------------------
// All of these settings are defined in IControlSettings.
#define CONTROL_SETTINGS(X) \
X(winrt::hstring, ProfileName) \
X(winrt::guid, SessionId) \
X(bool, EnableUnfocusedAcrylic, false) \
X(winrt::hstring, Padding, DEFAULT_PADDING) \

View File

@ -428,9 +428,9 @@ void Selection::ClearSelection(const bool fStartingNewSelection)
// - This does not validate whether there is a valid selection right now or not.
// It is assumed to already be in a proper selecting state and the given rectangle should be highlighted with the given color unconditionally.
// Arguments:
// - psrRect - Rectangular area to fill with color
// - psrRect - Rectangular area to fill with color (exclusive)
// - attr - The color attributes to apply
void Selection::ColorSelection(const til::inclusive_rect& srRect, const TextAttribute attr)
void Selection::ColorSelection(const til::rect& srRect, const TextAttribute attr)
{
auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
@ -438,8 +438,8 @@ void Selection::ColorSelection(const til::inclusive_rect& srRect, const TextAttr
auto& screenInfo = gci.GetActiveOutputBuffer();
til::point coordTargetSize;
coordTargetSize.x = CalcWindowSizeX(srRect);
coordTargetSize.y = CalcWindowSizeY(srRect);
coordTargetSize.x = srRect.width();
coordTargetSize.y = srRect.height();
til::point coordTarget;
coordTarget.x = srRect.left;
@ -475,9 +475,9 @@ void Selection::ColorSelection(const til::point coordSelectionStart, const til::
const auto& screenInfo = gci.GetActiveOutputBuffer();
const auto rectangles = screenInfo.GetTextBuffer().GetTextRects(coordSelectionStart, coordSelectionEnd, false, true);
for (const auto& rect : rectangles)
for (const auto& inclusiveRect : rectangles)
{
ColorSelection(rect, attr);
ColorSelection(til::rect{ inclusiveRect }, attr);
}
}
CATCH_LOG();

View File

@ -58,7 +58,7 @@ public:
void ClearSelection();
void ClearSelection(const bool fStartingNewSelection);
void ColorSelection(const til::inclusive_rect& srRect, const TextAttribute attr);
void ColorSelection(const til::rect& srRect, const TextAttribute attr);
void ColorSelection(const til::point coordSelectionStart, const til::point coordSelectionEnd, const TextAttribute attr);
// delete these or we can accidentally get copies of the singleton

View File

@ -698,7 +698,7 @@ bool Selection::_HandleColorSelection(const INPUT_KEY_INFO* const pInputKeyInfo)
for (auto&& sp : selection)
{
sp.iterate_rows(textBuffer.GetSize().Width(), [&](til::CoordType row, til::CoordType beg, til::CoordType end) {
ColorSelection({ beg, row, end, row }, selectionAttr);
ColorSelection({ beg, row, end, row + 1 }, selectionAttr);
});
}
ClearSelection();

View File

@ -220,6 +220,23 @@ std::pair<til::point, til::point> Selection::GetSelectionAnchors() const noexcep
endSelectionAnchor.x = (_d->coordSelectionAnchor.x == _d->srSelectionRect.left) ? _d->srSelectionRect.right : _d->srSelectionRect.left;
endSelectionAnchor.y = (_d->coordSelectionAnchor.y == _d->srSelectionRect.top) ? _d->srSelectionRect.bottom : _d->srSelectionRect.top;
// GH #18106: Conhost and Terminal share most of the selection code.
// Both now store the selection data as a half-open range [start, end),
// where "end" is the bottom-right-most point.
// Conhost operates as an inclusive range, so we need to adjust the "end" endpoint by incrementing it by one.
const auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
const auto& bufferSize = gci.GetActiveOutputBuffer().GetTextBuffer().GetSize();
if (IsLineSelection())
{
// General comparison for line selection.
bufferSize.IncrementInExclusiveBounds(startSelectionAnchor <= endSelectionAnchor ? endSelectionAnchor : startSelectionAnchor);
}
else
{
// Compare x-values when we're in block selection!
bufferSize.IncrementInExclusiveBounds(startSelectionAnchor.x <= endSelectionAnchor.x ? endSelectionAnchor : startSelectionAnchor);
}
if (startSelectionAnchor > endSelectionAnchor)
{
return { endSelectionAnchor, startSelectionAnchor };