Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/llm
Browse files Browse the repository at this point in the history
  • Loading branch information
consvc committed Aug 8, 2024
2 parents b8a1ddf + 746cf1f commit c8b9764
Show file tree
Hide file tree
Showing 44 changed files with 421 additions and 198 deletions.
1 change: 1 addition & 0 deletions .github/actions/spelling/expect/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ANSISYS
ANSISYSRC
ANSISYSSC
answerback
ANSWERBACKMESSAGE
antialiasing
ANull
anycpu
Expand Down
1 change: 1 addition & 0 deletions dep/Console/winconp.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ GetConsoleKeyboardLayoutNameW(
#define CONSOLE_REGISTRY_DEFAULTFOREGROUND L"DefaultForeground"
#define CONSOLE_REGISTRY_DEFAULTBACKGROUND L"DefaultBackground"
#define CONSOLE_REGISTRY_TERMINALSCROLLING L"TerminalScrolling"
#define CONSOLE_REGISTRY_ANSWERBACKMESSAGE L"AnswerbackMessage"
// end V2 console settings

/*
Expand Down
4 changes: 4 additions & 0 deletions doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3033,6 +3033,10 @@
"description": "By default Windows treats Ctrl+Alt as an alias for AltGr. When altGrAliasing is set to false, this behavior will be disabled.",
"type": "boolean"
},
"answerbackMessage": {
"description": "The response that is sent when an ENQ control character is received.",
"type": "string"
},
"source": {
"description": "Stores the name of the profile generator that originated this profile.",
"type": [
Expand Down
19 changes: 9 additions & 10 deletions src/cascadia/TerminalControl/ControlCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1689,22 +1689,22 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - resetOnly: If true, only Reset() will be called, if anything. FindNext() will never be called.
// Return Value:
// - <none>
SearchResults ControlCore::Search(const std::wstring_view& text, const bool goForward, const bool caseSensitive, const bool regularExpression, const bool resetOnly)
SearchResults ControlCore::Search(SearchRequest request)
{
const auto lock = _terminal->LockForWriting();
SearchFlag flags{};
WI_SetFlagIf(flags, SearchFlag::CaseInsensitive, !caseSensitive);
WI_SetFlagIf(flags, SearchFlag::RegularExpression, regularExpression);
const auto searchInvalidated = _searcher.IsStale(*_terminal.get(), text, flags);
WI_SetFlagIf(flags, SearchFlag::CaseInsensitive, !request.CaseSensitive);
WI_SetFlagIf(flags, SearchFlag::RegularExpression, request.RegularExpression);
const auto searchInvalidated = _searcher.IsStale(*_terminal.get(), request.Text, flags);

if (searchInvalidated || !resetOnly)
if (searchInvalidated || !request.Reset)
{
std::vector<til::point_span> oldResults;

if (searchInvalidated)
{
oldResults = _searcher.ExtractResults();
_searcher.Reset(*_terminal.get(), text, flags, !goForward);
_searcher.Reset(*_terminal.get(), request.Text, flags, !request.GoForward);

if (SnapSearchResultToSelection())
{
Expand All @@ -1716,12 +1716,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
else
{
_searcher.FindNext(!goForward);
_searcher.FindNext(!request.GoForward);
}

if (const auto idx = _searcher.CurrentMatch(); idx >= 0)
{
_terminal->SetSearchHighlightFocused(gsl::narrow<size_t>(idx));
_terminal->SetSearchHighlightFocused(gsl::narrow<size_t>(idx), request.ScrollOffset);
}
_renderer->TriggerSearchHighlight(oldResults);
}
Expand Down Expand Up @@ -1751,7 +1751,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
const auto lock = _terminal->LockForWriting();
_terminal->SetSearchHighlights({});
_terminal->SetSearchHighlightFocused({});
_terminal->SetSearchHighlightFocused({}, 0);
_renderer->TriggerSearchHighlight(_searcher.Results());
_searcher = {};
}
Expand Down Expand Up @@ -2938,5 +2938,4 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
_terminal->PreviewText(input);
}

}
2 changes: 1 addition & 1 deletion src/cascadia/TerminalControl/ControlCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void SetSelectionAnchor(const til::point position);
void SetEndSelectionPoint(const til::point position);

SearchResults Search(const std::wstring_view& text, bool goForward, bool caseSensitive, bool regularExpression, bool reset);
SearchResults Search(SearchRequest request);
const std::vector<til::point_span>& SearchResultRows() const noexcept;
void ClearSearch();
void SnapSearchResultToSelection(bool snap) noexcept;
Expand Down
12 changes: 11 additions & 1 deletion src/cascadia/TerminalControl/ControlCore.idl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ namespace Microsoft.Terminal.Control
Boolean EndAtRightBoundary;
};

struct SearchRequest
{
String Text;
Boolean GoForward;
Boolean CaseSensitive;
Boolean RegularExpression;
Boolean Reset;
Int32 ScrollOffset;
};

struct SearchResults
{
Int32 TotalMatches;
Expand Down Expand Up @@ -136,7 +146,7 @@ namespace Microsoft.Terminal.Control
void ResumeRendering();
void BlinkAttributeTick();

SearchResults Search(String text, Boolean goForward, Boolean caseSensitive, Boolean regularExpression, Boolean reset);
SearchResults Search(SearchRequest request);
void ClearSearch();
Boolean SnapSearchResultToSelection;

Expand Down
Loading

0 comments on commit c8b9764

Please sign in to comment.