How do the Tab and arrow keys work under the hood when navigating MenuComplete completions? #3835
-
First of all, thank you all for working on this amazing piece of software. I've recently switched to PowerShell, and creating new functionality using PSReadLine's functions was easier than I thought. I've also been paying particular attention to keyboard ergonomics, and how to adjust key bindings to make using a computer more comfortable for my fingers. When I invoke Menu completion with ctrl+spacebar, it is possible to navigate the suggestions using either the tab key or the arrow keys. I have been trying to remap ctrl+h,j,k,l to the PSReadLine functions which the arrow keys use under the hood, so that I could navigate the suggestions using familiar vim motions. Unfortunately, those mappings do not seem to work in menu completion; For instance, if I map ctrl+l to the right arrow key, and press ctrl+l to navigate to the right in the menu, I actually move one character to the right in the text buffer. Thus, here are some questions I have:
For reference, this StackOverflow user presents the same issue, but the answer is non-satisfactory. Note that the version of PSReadline I'm using is 2.3.4 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Key pressing in the menu completion context doesn't go through the key-binding handling. PSReadLine/PSReadLine/Completion.cs Lines 939 to 946 in ac69010 So, those actions cannot be bound in a custom way. |
Beta Was this translation helpful? Give feedback.
Key pressing in the menu completion context doesn't go through the key-binding handling.
While in the menu completion, it reads key directly through
Console.ReadKey()
, and then acts based on the key.PSReadLine/PSReadLine/Completion.cs
Lines 939 to 946 in ac69010