mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
Merge remote-tracking branch 'origin/main' into feature/llm
This commit is contained in:
commit
aa1f3ef91e
@ -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;
|
||||
}
|
||||
|
||||
@ -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()) };
|
||||
|
||||
@ -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; };
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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) \
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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 };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user