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 "recent commands" to Command Palette in commandline mode #8317

Merged
2 commits merged into from Nov 25, 2020

Conversation

Don-Vito
Copy link
Contributor

@Don-Vito Don-Vito commented Nov 18, 2020

Summary of the Pull Request

Add a history to command palette in the command line mode.
Few considerations/limitations

  1. In-memory, 10 entries hard-coded
  2. MRU
  3. List rather than set
  4. The user needs explicitly select command from the history

PR Checklist

Validation Steps Performed

  • Manual testing

@ghost ghost added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Nov 18, 2020
@Don-Vito
Copy link
Contributor Author

@zadjii-msft - this is how it behaves. Hope you like it 😊
CommandHistory

@Don-Vito Don-Vito marked this pull request as draft November 18, 2020 14:58
@Don-Vito Don-Vito force-pushed the 8296-commandpalette-command-history branch from 25b2c14 to 01ec21d Compare November 18, 2020 15:47
@Don-Vito Don-Vito marked this pull request as ready for review November 18, 2020 15:55
@DHowett
Copy link
Member

DHowett commented Nov 18, 2020

Oh my gosh you can search and filter them?

@Don-Vito
Copy link
Contributor Author

Oh my gosh you can search and filter them?

Absolutely. Even mark them bold 😛

@DHowett
Copy link
Member

DHowett commented Nov 18, 2020

i love this

@zadjii-msft
Copy link
Member

It's just so crisp

@Don-Vito
Copy link
Contributor Author

@zadjii-msft - do you want review this one? I could add a setting for history size, but probably let's start with validating the basic functionality?

@zadjii-msft
Copy link
Member

I really do, I'm just neck-deep in another investigation ATM that's taking 99% of my brain cycles. This is probably the next PR I review though

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

Wow, this was all so incredibly straightforward, I love it. I suppose 10 is a perfectly reasonable history size to start with - I'll be stunned if anyone hits that in a single session before we add #8324. And increasing the size with a setting wouldn't be that hard - but yea, let's wait till someone wants a longer history

Great idea & implementation!

src/cascadia/TerminalApp/CommandPalette.cpp Show resolved Hide resolved
{
_commandLineHistory.RemoveAtEnd();
}
_commandLineHistory.InsertAt(0, filteredCommand.value());
Copy link
Member

Choose a reason for hiding this comment

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

If you run the same command multiple times, will it keep getting added to the history? Should we try and de-duplicate entries in the history? (that is probably fine for a follow-up PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zadjii-msft - I took this approach because I didn't know what is the best behavior here, and in such cases I choose the simplest one. The options I considered were:

  • Set, sorted alphabetically
  • Set, sorted by MRU
  • List, sorted by MRU
  • A combination that you mentioned of don't push the command if it equals to the previous one

If you have a strong feeling about one of those, I can change this now or in followup (or we can add configs and leave to the user).

@Don-Vito
Copy link
Contributor Author

@DHowett - bumping this for the case you want to give me a homework for the long week-end 😊

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.

clever asf. love it.

@DHowett DHowett changed the title 8296: Add "recent commands' to Command Palette in commandline mode Add "recent commands" to Command Palette in commandline mode Nov 25, 2020
@DHowett
Copy link
Member

DHowett commented Nov 25, 2020

Open question: should we populate the search box when navigating the list?

I'm okay not doing this for now or going back and filing a followup 😄

Thanks again, this is lovely.

@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Nov 25, 2020
@ghost
Copy link

ghost commented Nov 25, 2020

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 274f5a7 into microsoft:main Nov 25, 2020
@Don-Vito Don-Vito deleted the 8296-commandpalette-command-history branch December 3, 2020 17:02
@ghost
Copy link

ghost commented Jan 28, 2021

🎉Windows Terminal Preview v1.6.10272.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants