PowerShell / ConsoleGuiTools

Modules that mix PowerShell and GUIs/CUIs!
https://www.powershellgallery.com/packages/Microsoft.PowerShell.ConsoleGuiTools
MIT License
794 stars 60 forks source link

OCGV: If items are selected, then a filter is applied, items now hidden stay selected #121

Closed tig closed 2 years ago

tig commented 4 years ago

What does Filter do?

1) Filter means Filter DISPLAY - Restrict what you see (current implementation). 2) Filter means Filter INPUT - Restrict the data you are working with.

Example:

Get-PSProfile | Out-ConsoleGridView -OutputMode Multiple -Title 'PS Profiles'

Select the two items: image image

Change the filter to "ISE": image

Select the first ISE item: image

Hit ENTER to Accept.

Note three items are returned: image

Thus, today, the Filter only impacts what is displayed.

Is this the right behavior?

I could argue it either way, but being explicit is going to be more important as ocgv gains more functionality (e.g. See my Select-All issue #120). I also have dreams of a cmdlet that makes editing data easy via console GUI. It seems to me we'd want the model to be consistent (or at least explicitly inconsistent).

Note, ogv works differently. If you select things in -OutputMode Multiple mode, and then change the filter, those selections are cleared. One could also argue that ocgv should match ogv here, which means it should use "Filter Means Filter INPUT" (2).

corbob commented 4 years ago

Here's my reminder to myself to read the whole thing before I start formulating my response 😬 I went and tested Windows PowerShell's ogv implementation to find exactly as you did that it means option 2. This is definitely the behavior I would expect and I would advocate for.

As a side note: @tig is Get-PSProfile a custom function, or is it part of a module that someone might be able to download?

tig commented 4 years ago

Get-PSProfile is part of https://github.com/jdhitsolutions/PSScriptTools.

I forgot how I found it, but use it for testing because it gives lots of columns with different lengths and thus stresses ocgv well. I forgot it wasn't a built-in.

I'll do a PR to "fix" ocgv per this Issue...

tig commented 2 years ago

I believe this should be fixed. Working on PR now.

tig commented 2 years ago

Fixed in #166