Psreadline: PredictionViewStyle allow combined List and Inline or keybinding to adhoc turn use the List view

Created on 5 Nov 2020  路  4Comments  路  Source: PowerShell/PSReadLine

Description of the new feature/enhancement

Although the Listview is awesome, I've already become very accustomed to the Inline style and I'm missing the ctrl+f option to accept next words in the initial predicted text. Also missing in my flow now is the right arrow accept full first completion.

Proposed technical implementation details (optional)

Allow a combined implementation or keybinding initialization of the listview on adhoc basis

Issue-Enhancement

Most helpful comment

Is there a workaround for this as well?

Unfortunately, not workaround yet. Thanks for bringing this up! I guess it would be reasonably common for people to re-bind UpArrow and DownArrow to HistorySearchBackward and HistorySearchForward. We will need to improve those 2 functions to make them behave similarly to PreviousHistory and NextHistory -- able to sense a list view is present and navigate in the list instead of history in that case.

All 4 comments

The list view could be used as a supplement to the inline view, especially when you know what you want is in the history but not the most recent item in history. In that case, the list view can be very helpful as it shows more candidates.

In the Windows edit more, we introduced F2 as the hotkey to switch between the InlineView and the ListView. You may find it very handy.

demo

Thanks @daxian-dbw f2 was not registered for me (using emacs mode). I registered it manually and the function works fine. This is a nice middleground and has the desired effect. One caveat however is this. I have the following keybinding in case of inlineview:

Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward

Setting these will brick the list view (can not navigate the list). Is there a workaround for this as well?

Is there a workaround for this as well?

Unfortunately, not workaround yet. Thanks for bringing this up! I guess it would be reasonably common for people to re-bind UpArrow and DownArrow to HistorySearchBackward and HistorySearchForward. We will need to improve those 2 functions to make them behave similarly to PreviousHistory and NextHistory -- able to sense a list view is present and navigate in the list instead of history in that case.

I'll close this issue. Thanks for adding this to the improvement list!

Was this page helpful?
0 / 5 - 0 ratings