Closed MrFly72 closed 1 year ago
@andschwa maybe this one is easy to implement? and it would be a huge comfort improvement, especially as Out-ConsoleGridView might be used a lot with keyboard.
Why not have what you suggest be the default behavior?
I'm not a fan of adding more and more options.
In my eyes it can also be the default. I was just curious because changing a current because is also not nice sometimes as others might complain.
No idea if it's easy or not, try it!
@andschwa please edit this title to prefix with "OCGV: ". Gracias.
The reason I didn't push to get this in quickly is it's more complicated than I originally thought.
I now believe this functionality should be optional and propose -MoveToNextOnSelect
:
-MoveToNextOnSelect
If specified, pressing SPACE to select an item (when '-OutputMode Multiple' is enabled) will toggle the state of the item and move the selection to the next item in the list.
Required? false
Position? Named
Accept pipeline input? false
Parameter set name (All)
Aliases None
Dynamic? false
Accept wildcard characters? false
Without resorting to some hackery, the right way to implement this is by implementing a new feature in Terminal.Gui
's ListView
that turns on off/this behavior.
The code in ocgv
would thus, be
// in OutConsoleGridviewCmdletCommand.cs:
/// <summary>
/// If specified, pressing SPACE to select an item (when '-OutputMode Multiple' is enabled) will toggle the state of the item and move the selection to the next item in the list.
/// </summary>
[Parameter(HelpMessage = "If specified, pressing SPACE to select an item (when '-OutputMode Multiple' is enabled) will toggle the state of the item and move the selection to the next item in the list.")]
public SwitchParameter MoveToNextOnSelect { set; get; }
// In ConsoleGui.cs @ line 387, before the call to win.Add(_listView):
_listView.MoveToNextOnToggleKey
The reason this is tricky is ListView
doesn't currently distinguish between a toggle happening via keypress (SPACE) or some other means.
I've created an issue in Terminal.Gui for this new feature: https://github.com/gui-cs/Terminal.Gui/issues/1962
It would be great if Out-ConsoleGridView could have a parameter somehow like -skiptonextelementonselect Or whatever makes sense as parameter name. Basically with this set after a selection of an element, the cursor will move to the next line instead of staying at the same.