Skip to content

PredictionViewStyle ListView allow escape out of selection in emacs mode #1932

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

Closed
bgelens opened this issue Nov 5, 2020 · 7 comments
Closed
Labels
Issue-Enhancement It's a feature request.

Comments

@bgelens
Copy link

bgelens commented Nov 5, 2020

Description of the new feature/enhancement

The new ListView for predictions is awesome! One thing I've found a little bit impacting my flow, is the lack of ability to escape out of the list and just return to what I had typed. I've tried a couple of keybindings but none seem to work.

image

The only option is to arrow up until I'm out of the list view. This will return my original input

image

Proposed technical implementation details (optional)

Allow Escape to directly return back to what was typed and return the cursor position

cc @SteveL-MSFT

@bgelens bgelens added the Issue-Enhancement It's a feature request. label Nov 5, 2020
@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Nov 5, 2020
@daxian-dbw
Copy link
Member

daxian-dbw commented Nov 5, 2020

Hello @bgelens, thanks for trying out this feature!
Which EditMode were you in? The prediction ListView has been mainly tested and enhanced in the Windows edit mode.
Testing in the Emacs and VI edit modes is very minimum as of today, but we will spend more time improving its user experience in these 2 edit modes (Issue to track: #1934).

You can check your edit mode by Get-PSReadLineOption | % EditMode, and switching to Windows by Set-PSReadLineOption -EditMode Windows.

@daxian-dbw
Copy link
Member

If you are using the Windows edit mode, you will find Escape works as expected -- pressing it will escape out of the list and return to what I had typed. Ctrl+z (undo) will also be handy for you to escape out of a selection. Please see the "Handling of Commonly Used Keys" section in the PR description of #1909 to learn more about the details.

Also, we will have a blog posted next week about this feature, so please stay tuned.

@bgelens
Copy link
Author

bgelens commented Nov 5, 2020

Hey @daxian-dbw. Thanks for the info.

I'm using emacs (running on Mac where this is more natural fit). I did not think about using ctrl+z. I can confirm it has the desired effect for me! I'll use this as a workaround for now (esc will be more natural and getting from your reply it is mend to work)

@daxian-dbw
Copy link
Member

daxian-dbw commented Nov 5, 2020

Yes, Escape in Emacs edit mode should work the same as in the Windows edit mode, and we will make that improvement for the next beta release.

@daxian-dbw daxian-dbw removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Nov 5, 2020
@bgelens bgelens changed the title PredictionViewStyle ListView allow escape out of selection PredictionViewStyle ListView allow escape out of selection in emacs mode Nov 5, 2020
@bgelens
Copy link
Author

bgelens commented Nov 5, 2020

Should I close this issue considering the tracking issue you created? If so please feel free to close yourself :)

@daxian-dbw
Copy link
Member

I will close this one as a duplicate of #1934. Thanks @bgelens!

@daxian-dbw
Copy link
Member

It turns out Escape in Emacs edit mode is already bound to ChordFirstKey and that means it's a special key indicating a chord of keys (e.g Escape,f, Escape,d, or even Escape,Ctrl+y). So we cannot make Escape to work the same as in the Windows edit mode.

A workaround would be to map Escape, Escape to RevertLine, so you can press ESC twice to get the same behavior as in Windows edit mode.

Set-PSReadLineKeyHandler -Key 'Escape, Escape' -Function RevertLine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement It's a feature request.
Projects
None yet
Development

No branches or pull requests

2 participants