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

Introduce ExpandSelectionToWord action #13765

Merged
3 commits merged into from
Aug 31, 2022
Merged

Introduce ExpandSelectionToWord action #13765

3 commits merged into from
Aug 31, 2022

Conversation

carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Aug 17, 2022

Summary of the Pull Request

Introduces a new action expandSelectionToWord() which expands the beginning and end of the selection to encompass the word(s) it's on. This was implemented as a conditional keybinding where the key chord is passed through to the terminal if no selection is active (similar to copy()).
It is not bound to anything by default.

PR Checklist

Validation Steps Performed

  • Scenario in Search behavior in Terminal -- add capability to insert the matched hit #8274:
    • search for some text in the find dialog
    • ESC to close the dialog
    • execute expandSelectionToWord()
    • the new selection encompasses the whole word
  • mark mode
    • move onto a word
    • execute expandSelectionToWord()
  • mouse selection (same as above)
  • select a portion of two words --> new selection fully encompasses both words

@ghost ghost added Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. labels Aug 17, 2022
@carlos-zamora
Copy link
Member Author

  1. I could easily abstract this action into expandSelection(mode: {cell|word|line|view|buffer}) but that all sounds... not useful.
  2. Current behavior is that if the selection encompasses multiple words, the selection is expanded to encompass all of them entirely (i.e. "hell[o w]orld" --> "[hello world]"). I could change this to only expand at the active endpoint, but that sounds like a pretty niche thing imo.

Let me know if you disagree with my assumptions above.

@carlos-zamora carlos-zamora force-pushed the dev/cazamor/expand-sln-action branch from b2486cb to f9d118d Compare August 17, 2022 17:11
@zadjii-msft
Copy link
Member

Current behavior is that if the selection encompasses multiple words

what about a selection of hello [w]orld - that expands to hello [world] (right?), then what would the next expandSelectionToWord do?

@zadjii-msft
Copy link
Member

RE expandSelection(mode: {cell|word|line|view|buffer}): That sounds like what home/end/pgup/dn/ctrl+a are for.

@carlos-zamora
Copy link
Member Author

what about a selection of hello [w]orld - that expands to hello [world] (right?), then what would the next expandSelectionToWord do?

hello [w]orld --> hello [world] --> hello [world] (you're already on the whole word so no more to expand to)

VS Code has an "Expand Selection" action for Shift+Alt+Right. That expands to word --> line -->doc. (so if you're already on the whole word, it goes to line, etc...).

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.

ez

@zadjii-msft zadjii-msft added the Needs-Second It's a PR that needs another sign-off label Aug 24, 2022
@ghost ghost requested review from PankajBhojwani, DHowett and lhecker August 24, 2022 16:50
@carlos-zamora
Copy link
Member Author

carlos-zamora commented Aug 26, 2022

From bug bash:
- [ ] Mark mode --> move to middle of word --> ExpandSelectionToWord --> Shift+Right/Left --> weird updated selection

Moved to #13854

@zadjii-msft zadjii-msft added this to the Terminal v1.16 milestone Aug 29, 2022
@DHowett
Copy link
Member

DHowett commented Aug 29, 2022

make sure this gets into the docs!

@carlos-zamora carlos-zamora added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 31, 2022
@ghost
Copy link

ghost commented Aug 31, 2022

Hello @carlos-zamora!

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 11e7bbc into main Aug 31, 2022
@ghost ghost deleted the dev/cazamor/expand-sln-action branch August 31, 2022 19:06
@ghost
Copy link

ghost commented Sep 13, 2022

🎉Windows Terminal Preview v1.16.252 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-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Area-UserInterface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Second It's a PR that needs another sign-off Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search behavior in Terminal -- add capability to insert the matched hit
3 participants