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

Clip the "current commandline" at the cursor position #17781

Merged
merged 2 commits into from
Aug 23, 2024

Conversation

zadjii-msft
Copy link
Member

This is particularly relevant to pwsh with the "ghost text" enabled. In that scenario, pwsh writes out the predicted command to the right of the cursor. With showSuggestions(useCommandline=true), we'd auto-include that text in the filter, and that was effectively useless.

This instead defaults us to not use anything to the right of the cursor (inclusive) for what we consider "the current commandline"

closes #17772

This is particularly relevant to pwsh with the "ghost text" enabled. In that
scenario, pwsh writes out the predicted command to the right of the cursor. With
`showSuggestions(useCommandline=true)`, we'd auto-include that text in the
filter, and that was effectively useless.

This instead defaults us to not use anything to the right of the cursor
(inclusive) for what we consider "the current commandline"

closes #17772
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

good enough.

@DHowett
Copy link
Member

DHowett commented Aug 22, 2024

We have a test that explicitly checks for this. We will need to remove it.

// (also account for the fact that the cursor may be in the middle of a commandline)
if (!commands.empty() &&
!trimmedCurrentCommand.empty() &&
std::wstring{ commands.back() }.substr(0, trimmedCurrentCommand.size()) == trimmedCurrentCommand)
Copy link
Member

Choose a reason for hiding this comment

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

Use wstring_view here. The commands vector isn't being deleted during this line after all.

@zadjii-msft
Copy link
Member Author

Something is suspiciously polluting the test state here:
image

@DHowett DHowett merged commit cd8c125 into main Aug 23, 2024
20 checks passed
@DHowett DHowett deleted the dev/migrie/b/clip-commandline-at-cursor branch August 23, 2024 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants