Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a useCommandline property to the suggestions action #15027

Merged
merged 119 commits into from Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
c96799c
Preview the input via the TSF input control. This is awesome, and sho…
zadjii-msft Mar 22, 2022
1449088
bugfixes for the demo
zadjii-msft Apr 1, 2022
d3b5533
fix remaining bugs
zadjii-msft Apr 29, 2022
0bda66f
a comment I missed
zadjii-msft Apr 29, 2022
ccfc834
Migrate spelling-0.0.21 changes from main
DHowett Apr 29, 2022
c97ac66
resart with fresh plumbing
zadjii-msft Feb 9, 2023
7404dc3
zhu li, do the thing
zadjii-msft Feb 10, 2023
f361b6c
lots of removal of dead code from the sxnui
zadjii-msft Feb 10, 2023
b0fa972
make the menu mode compact, and remove the search box
zadjii-msft Feb 12, 2023
985fcdb
better UX for typing
zadjii-msft Feb 12, 2023
e785bfc
Merge branch 'main' into dev/migrie/f/12861-preview-input
zadjii-msft Feb 16, 2023
48e7348
small updates to the protocol
zadjii-msft Feb 16, 2023
026f342
Merge remote-tracking branch 'origin/dev/migrie/f/3121-wE-dOnT-hAvE-d…
zadjii-msft Feb 21, 2023
ff5eead
Very important that the backspaces are trimmed from the preview
zadjii-msft Feb 21, 2023
2c66c32
bottoms up bottoms up
zadjii-msft Feb 21, 2023
d94183b
icons are _slick_
zadjii-msft Feb 21, 2023
8feb909
bottom-up mode is basically done
zadjii-msft Feb 21, 2023
f5909d9
Open in different directions based on available space
zadjii-msft Feb 22, 2023
4516b4b
Properly account for the position of panes when opening the menu
zadjii-msft Feb 22, 2023
a3c4776
clamp horizontally
zadjii-msft Feb 23, 2023
7988d89
code cleanup
zadjii-msft Feb 23, 2023
84a41b4
cleanup _for review_?
zadjii-msft Feb 23, 2023
36b5759
[PARENT] lmao I deleted the line that sends the inpu :facepalm"
zadjii-msft Feb 24, 2023
f3796da
mostly all the plumbing to get this back into a reasonable state
zadjii-msft Feb 24, 2023
f4c310a
make this actually work again
zadjii-msft Feb 24, 2023
dc71f0c
align to the cursor in bottoms up mode
zadjii-msft Feb 24, 2023
c9e7156
notes, cleanup, order the history correctly
zadjii-msft Feb 24, 2023
5defde5
POC: We can take it out of the Popup and have it still work
zadjii-msft Feb 24, 2023
57a5327
very confident we can get all the logic into the sxnui
zadjii-msft Feb 24, 2023
a172f53
Finish detaching it from the popup
zadjii-msft Mar 1, 2023
e2cc278
POC: We can take it out of the Popup and have it still work
zadjii-msft Feb 24, 2023
e544871
very confident we can get all the logic into the sxnui
zadjii-msft Feb 24, 2023
173a830
Finish detaching it from the popup
zadjii-msft Mar 1, 2023
a21c815
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Mar 1, 2023
20f5651
final cleanup for review
zadjii-msft Mar 1, 2023
236912a
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Mar 2, 2023
442413f
Final cleanup for review
zadjii-msft Mar 2, 2023
9d5ef3a
format and spell
zadjii-msft Mar 2, 2023
cd2db82
Merge branch 'main' into dev/migrie/fhl-2023/pwsh-autocomplete-demo
zadjii-msft Mar 10, 2023
22c94bf
spell
zadjii-msft Mar 10, 2023
28555a6
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl-2023/p…
zadjii-msft Mar 20, 2023
36b676a
Add a setting to opt in, because feature flags are imprecise
zadjii-msft Mar 20, 2023
b096469
austin mode
zadjii-msft Mar 20, 2023
4e46a63
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Mar 20, 2023
6c778a6
yea no I always run the tests
zadjii-msft Mar 20, 2023
172a298
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Mar 21, 2023
dfd4e27
Add a useCommandline property to the suggestions action
zadjii-msft Mar 21, 2023
0c19591
This fixes a previewing issue, all the way back in the first PR
zadjii-msft Mar 21, 2023
db99537
Pre-filter the commands, and use the typed command to construct the s…
zadjii-msft Mar 21, 2023
363c092
substr takes a count you dingus
zadjii-msft Mar 21, 2023
4766b62
substr takes a count, not an end
zadjii-msft Mar 21, 2023
dea426a
And my command name
zadjii-msft Mar 21, 2023
62fb61d
spell
zadjii-msft Mar 21, 2023
dc4a832
substr takes a count, not an end
zadjii-msft Mar 21, 2023
19c1ed9
This fixes a previewing issue, all the way back in the first PR
zadjii-msft Mar 21, 2023
dd5458c
spell
zadjii-msft Mar 21, 2023
df92394
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Mar 21, 2023
51046c5
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Mar 21, 2023
2088d32
Add a range version of ROW::GetText
lhecker Mar 23, 2023
cc05133
Woops, wrong method
lhecker Mar 23, 2023
11916fd
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl-2023/p…
zadjii-msft Mar 24, 2023
1c52862
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Mar 24, 2023
837c544
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Mar 24, 2023
3ea3860
this is so much cleaner
zadjii-msft Mar 27, 2023
d593fe1
Add a range version of ROW::GetText
lhecker Mar 23, 2023
f56d258
Woops, wrong method
lhecker Mar 23, 2023
4c2499c
this is so much cleaner
zadjii-msft Mar 27, 2023
057098e
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl-2023/p…
zadjii-msft Apr 5, 2023
62863f1
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' of https://gi…
zadjii-msft Apr 5, 2023
a530ccc
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Apr 5, 2023
920353a
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Apr 5, 2023
3fc364c
Merge branch 'main' into dev/migrie/fhl-2023/pwsh-autocomplete-demo
zadjii-msft May 31, 2023
fb40b5d
lazy loading for fun and profit
zadjii-msft May 31, 2023
d4422bb
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft May 31, 2023
6575e5a
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft May 31, 2023
2cf9f41
Merge branch 'main' into dev/migrie/fhl-2023/pwsh-autocomplete-demo
zadjii-msft Jul 5, 2023
b8d8f11
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Jul 5, 2023
ad62ad8
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Jul 5, 2023
741b773
This needs to go way earlier in the stack of PRs
zadjii-msft Jul 6, 2023
434572a
Merge branch 'main' into dev/migrie/fhl-2023/pwsh-autocomplete-demo
zadjii-msft Aug 1, 2023
12d2160
minor code movement
zadjii-msft Aug 1, 2023
f10f14c
this is better
zadjii-msft Aug 1, 2023
1a8275e
move code around
zadjii-msft Aug 1, 2023
7ae4716
use less int math where possible
zadjii-msft Aug 1, 2023
1720905
last refactoring - Open() instead of Anchor()
zadjii-msft Aug 2, 2023
45a6e1d
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Aug 2, 2023
8879a1f
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Aug 2, 2023
27b3aac
this needed refactoring
zadjii-msft Aug 2, 2023
7c3fd2a
Remove input previewing. We can necro later. It's too hacky
zadjii-msft Aug 2, 2023
3ee1f9b
load bearing I guess
zadjii-msft Aug 2, 2023
ce70a37
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Aug 2, 2023
0bb3a8f
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Aug 2, 2023
f9a764e
lots of load bearing code here
zadjii-msft Aug 2, 2023
a013020
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl-2023/p…
zadjii-msft Aug 8, 2023
0cf6475
whole pile of PR nits
zadjii-msft Aug 8, 2023
902ee8e
raise the event relative to the sender
zadjii-msft Aug 8, 2023
8f0b6f8
revert 1449088, d3b5533 and 0bda66f, because we didn't know what they…
zadjii-msft Aug 8, 2023
4de9303
runformat
zadjii-msft Aug 8, 2023
873d8d4
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl-2023/p…
zadjii-msft Aug 8, 2023
a21977b
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Aug 8, 2023
ff5ce00
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Aug 8, 2023
16492a7
fix the build
zadjii-msft Aug 8, 2023
9070557
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Aug 8, 2023
1759213
oneliner mistakes
zadjii-msft Aug 9, 2023
c1339bc
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Aug 9, 2023
a68f229
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Aug 9, 2023
ef7f563
this would crash the palette if there were nested items
zadjii-msft Aug 9, 2023
2bceb92
these are also vestigial
zadjii-msft Aug 9, 2023
4110f2c
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Aug 9, 2023
b7f8b36
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Aug 9, 2023
dff4ae3
update my formatter so it stops blowing up
zadjii-msft Aug 9, 2023
3748900
Merge branch 'dev/migrie/fhl-2023/pwsh-autocomplete-demo' into dev/mi…
zadjii-msft Aug 9, 2023
8767448
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Aug 9, 2023
f23c859
Apply suggestions from code review
zadjii-msft Aug 10, 2023
1e91a1c
Merge remote-tracking branch 'origin/main' into dev/migrie/f/14779-sx…
zadjii-msft Aug 14, 2023
f84d139
remove comment
zadjii-msft Aug 14, 2023
382983e
Merge branch 'dev/migrie/f/14779-sxnui-recent-commands' into dev/migr…
zadjii-msft Aug 14, 2023
3be1201
Merge remote-tracking branch 'origin/main' into dev/migrie/f/sxnui-us…
zadjii-msft Aug 15, 2023
54234a9
runformat
zadjii-msft Aug 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/allow/allow.txt
Expand Up @@ -95,6 +95,7 @@ slnt
Sos
ssh
stakeholders
sxn
timeline
timelines
timestamped
Expand Down
3 changes: 3 additions & 0 deletions .github/actions/spelling/expect/expect.txt
Expand Up @@ -315,6 +315,7 @@ CPLINFO
cplusplus
CPPCORECHECK
cppcorecheckrules
cpprest
cpprestsdk
cppwinrt
CProc
Expand Down Expand Up @@ -1452,6 +1453,7 @@ PPEB
ppf
ppguid
ppidl
pplx
PPROC
ppropvar
ppsi
Expand Down Expand Up @@ -2132,6 +2134,7 @@ WDDMCONSOLECONTEXT
wdm
webpage
websites
websockets
wekyb
wex
wextest
Expand Down
11 changes: 6 additions & 5 deletions src/buffer/out/Row.cpp
Expand Up @@ -890,11 +890,12 @@ std::wstring_view ROW::GetText() const noexcept

std::wstring_view ROW::GetText(til::CoordType columnBegin, til::CoordType columnEnd) const noexcept
{
const til::CoordType columns = _columnCount;
const auto colBeg = std::max(0, std::min(columns, columnBegin));
const auto colEnd = std::max(colBeg, std::min(columns, columnEnd));
const size_t chBeg = _uncheckedCharOffset(gsl::narrow_cast<size_t>(colBeg));
const size_t chEnd = _uncheckedCharOffset(gsl::narrow_cast<size_t>(colEnd));
// This ensures that `chEnd >= chBeg` will always be true.
// That way we can safely calculate `chEnd - chBeg`.
columnEnd = std::max(columnBegin, columnEnd);

const size_t chBeg = _uncheckedCharOffset(_clampedColumnInclusive(columnBegin));
const size_t chEnd = _uncheckedCharOffset(_clampedColumnInclusive(columnEnd));
#pragma warning(suppress : 26481) // Don't use pointer arithmetic. Use span instead (bounds.1).
return { _chars.data() + chBeg, chEnd - chBeg };
}
Expand Down
21 changes: 21 additions & 0 deletions src/cascadia/TerminalApp/ActionPreviewHandlers.cpp
Expand Up @@ -50,6 +50,7 @@ namespace winrt::TerminalApp::implementation
{
case ShortcutAction::SetColorScheme:
case ShortcutAction::AdjustOpacity:
case ShortcutAction::SendInput:
{
_RunRestorePreviews();
break;
Expand Down Expand Up @@ -140,6 +141,23 @@ namespace winrt::TerminalApp::implementation
});
}

void TerminalPage::_PreviewSendInput(const Settings::Model::SendInputArgs& args)
{
const auto backup = _restorePreviewFuncs.empty();

_ApplyToActiveControls([&](const auto& control) {
const auto& str{ args.Input() };
control.PreviewInput(str);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an accidental change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a debugging change. I'll revert that


if (backup)
{
_restorePreviewFuncs.emplace_back([=]() {
// On dismiss:
control.PreviewInput(L"");
});
}
});
}
void TerminalPage::_PreviewAction(const Settings::Model::ActionAndArgs& args)
{
switch (args.Action())
Expand All @@ -150,6 +168,9 @@ namespace winrt::TerminalApp::implementation
case ShortcutAction::AdjustOpacity:
_PreviewAdjustOpacity(args.Args().try_as<AdjustOpacityArgs>());
break;
case ShortcutAction::SendInput:
_PreviewSendInput(args.Args().try_as<SendInputArgs>());
break;
}

// GH#9818 Other ideas for actions that could be preview-able:
Expand Down
29 changes: 29 additions & 0 deletions src/cascadia/TerminalApp/AppActionHandlers.cpp
Expand Up @@ -1247,6 +1247,35 @@ namespace winrt::TerminalApp::implementation
}
}

void TerminalPage::_HandleSuggestions(const IInspectable& /*sender*/,
const ActionEventArgs& args)
{
if (args)
{
if (const auto& realArgs = args.ActionArgs().try_as<SuggestionsArgs>())
{
auto source = realArgs.Source();

switch (source)
{
case SuggestionsSource::CommandHistory:
{
if (const auto& control{ _GetActiveControl() })
{
const auto context = control.CommandHistory();
const auto& currentCmd{ realArgs.UseCommandline() ? context.CurrentCommandline() : L"" };
_OpenSuggestions(Command::HistoryToCommands(context.History(), currentCmd, false),
SuggestionsMode::Palette,
currentCmd);
}
args.Handled(true);
}
break;
}
}
}
}

void TerminalPage::_HandleColorSelection(const IInspectable& /*sender*/,
const ActionEventArgs& args)
{
Expand Down
17 changes: 14 additions & 3 deletions src/cascadia/TerminalApp/CommandPalette.cpp
Expand Up @@ -225,15 +225,24 @@ namespace winrt::TerminalApp::implementation
void CommandPalette::_selectedCommandChanged(const IInspectable& /*sender*/,
const Windows::UI::Xaml::RoutedEventArgs& /*args*/)
{
const auto currentlyVisible{ Visibility() == Visibility::Visible };

const auto selectedCommand = _filteredActionsView().SelectedItem();
const auto filteredCommand{ selectedCommand.try_as<winrt::TerminalApp::FilteredCommand>() };
if (_currentMode == CommandPaletteMode::TabSwitchMode)
{
_switchToTab(filteredCommand);
}
else if (_currentMode == CommandPaletteMode::ActionMode && filteredCommand != nullptr)
else if (_currentMode == CommandPaletteMode::ActionMode &&
currentlyVisible)
{
if (const auto actionPaletteItem{ filteredCommand.Item().try_as<winrt::TerminalApp::ActionPaletteItem>() })
// If we don't have a selected command, then end any previews we
// might currently be showing.
if (filteredCommand == nullptr)
{
_PreviewActionHandlers(*this, nullptr);
}
else if (const auto actionPaletteItem{ filteredCommand.Item().try_as<winrt::TerminalApp::ActionPaletteItem>() })
{
_PreviewActionHandlers(*this, actionPaletteItem.Command());
}
Expand Down Expand Up @@ -1083,7 +1092,9 @@ namespace winrt::TerminalApp::implementation
{
std::copy(begin(commandsToFilter), end(commandsToFilter), std::back_inserter(actions));
}
else if (_currentMode == CommandPaletteMode::TabSearchMode || _currentMode == CommandPaletteMode::ActionMode || _currentMode == CommandPaletteMode::CommandlineMode)
else if (_currentMode == CommandPaletteMode::TabSearchMode ||
_currentMode == CommandPaletteMode::ActionMode ||
_currentMode == CommandPaletteMode::CommandlineMode)
{
for (const auto& action : commandsToFilter)
{
Expand Down