Skip to content
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

OCGV:Different Filter will "forget" all selected before #174

Closed
3 tasks done
MrFly72 opened this issue Aug 25, 2022 · 24 comments · Fixed by #186
Closed
3 tasks done

OCGV:Different Filter will "forget" all selected before #174

MrFly72 opened this issue Aug 25, 2022 · 24 comments · Fixed by #186
Assignees
Labels
bug Something isn't working OCGV

Comments

@MrFly72
Copy link

MrFly72 commented Aug 25, 2022

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

When a filter is active at the end of choosing elements, only the elements that are included in the active filter will be returned.
eg.:
Get-Process | Out-ConsoleGridView
Check one process, eg. Word
Filter by eg.Notepad, check Notepad
When you now hit enter with the active filter for notepad, only notepad will be returned

There is only one workaround this, you have to remove the filter before hitting enter.

This bug is introduced in the newer version, as before, hitting enter in a filtered list, would gather all elements that have been checked.

Expected behavior

Word + Notepad should be returned

Actual behavior

Only notepad is returned

Error details

No Error ourput

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.6
PSEdition                      Core
GitCommitId                    7.2.6
OS                             Linux 5.15.56-v8+ #1575 SMP PREEMPT Fri Jul 22 20:31:26 BST 2022
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

0.7.2

Visuals

No response

@tig
Copy link
Collaborator

tig commented Aug 25, 2022

This is caused by #163

I agree this is a change in behavior and it's a bummer it impacted you.

I think it's too late to revert/fix this for 0.7.2 as @andschwa notes.

We can definitely fix for 0.7.3.

The question is, how do I fix it?

See #121 for more background.

@tig tig added bug Something isn't working OCGV labels Aug 25, 2022
@tig tig self-assigned this Aug 25, 2022
@MrFly72
Copy link
Author

MrFly72 commented Aug 26, 2022

I want to describe my impact on this a little bit more in detail.
I am using OCGV on a Raspberry Pi for a script I wrote to automate Media Download from State TV.
Basically it filters series etc. by rest-api from a source-page, then displays them with OCGV to check for shows to be downloaded.
To easier check them, as it is usually a list of 1800 shows, I filter them, eg. "Show 1", then check the ones to download, then filter by "show 2" and mark others to download and so on.
at the end, i press enter to accept all shows and then the script will add download jobs on my NAS by rest-api.
it will wait for all shows to download and rename them by defined pattern (eg. Date-Series.Title-Episode-Title.mp4).
I know, that the Windows Version of OGV, also does not "keep" marked entries by "CTRL", but on the other end there are no checkboxes, so totally different approach.

For me it would be valuable, for the checkmarks to be persistent through filters.
At the moment, the workaround for me is, to remove the filter before "enter", as the checkmarks will persist.
The only bummer is, that you really have to clear filter by "backspace" character by character

@BDisp
Copy link

BDisp commented Aug 26, 2022

The only bummer is, that you really have to clear filter by "backspace" character by character

The Filter has a ContextMenu with a Delete All where you can delete all text at once.

@MrFly72
Copy link
Author

MrFly72 commented Aug 27, 2022

How do I reach the context menu on Linux shell?
Did not find any possibility in an ssh shell

@BDisp
Copy link

BDisp commented Aug 27, 2022

How do I reach the context menu on Linux shell? Did not find any possibility in an ssh shell

By mouse right clicking on the TextField or by pressing Ctrl+Shift+D. But I see that this isn't working on the current build. I submitted this pr gui-cs/Terminal.Gui#1968 to allow pressing Ctrl+R, because Linux don't differentiate Ctrl+alfa from Ctrl+Shift+alfa.

@MrFly72
Copy link
Author

MrFly72 commented Aug 27, 2022

Mouse? Hehe. Don't use one on my iPad which connects via SSH to the raspian shell and then use the shell to start pwsh.
So keyboard is essential for this.

@BDisp
Copy link

BDisp commented Aug 28, 2022

Mouse? Hehe. Don't use one on my iPad which connects via SSH to the raspian shell and then use the shell to start pwsh. So keyboard is essential for this.

I forgot to mention that the context menu can be opened with the keyboard by pressing Shift+F10, but I don't know why it isn't opening with the current build.

@MrFly72
Copy link
Author

MrFly72 commented Aug 28, 2022

Ok. I mean I can understand that some people want it this way (Filter will forget all previously checked).
As in the thread which changed this was mentioned, there are people who want his behavior and some don't. This is a typical area for a switch. Default could be "drop selections" and a switch like -keepselectsonfilter could keep them.

@MrFly72
Copy link
Author

MrFly72 commented Sep 2, 2022

I must realize, that I more then once walked into this issue, even after knowing that it changed.
HAd this great way before:

  • Filter --> Select
  • Filter something else --> Select
  • ....
  • hit enter and go.
    now the way is to get back to "without filter" first and then hit enter, and I forget that pretty much all the time.
    Additionally to that, this change is also not complety thought through, as the elements keep checked and when you get back to "no filter", the ones from before the filter are still checked.
    I think it really needs a switch like "Keep selected on filter change" which should also take all into count on pressing enter.
    and if the switch is not set, it would also forget the selected from before the filter.
    But nevertheless I think this would be time for a gui-enhancement, too.
    there could be a couple of values: #selected in this filter + #selected total.

@tznind
Copy link
Contributor

tznind commented Sep 2, 2022

Would a solution be to 'pin' selected items regardless of filter? So if an item is checked then it doesn't disappear even when the filter is changed? That should make clear that the ticked items are going to be confirmed even if they don't match the filter?

Sort of like this:
pinningmultiselect
Ignore the random reorder of items as they are ticked ;)

Apologies if I have misunderstood the issue.

@MrFly72
Copy link
Author

MrFly72 commented Sep 2, 2022

Would also be ok in my eyes.
And I think the counter of how many are selected is also not a bad idea.

@BDisp
Copy link

BDisp commented Sep 2, 2022

That is the best solution. Maintaining a track on each new filter to the ID of all the available items from the empty filter.

@MrFly72
Copy link
Author

MrFly72 commented Dec 26, 2022

Is someone actively working on this?
I must really admit that I really often "pitfall" into this.
Filter, check some element, filter something else, check some additional and then forget to delete filters and will only have the elements with the checked ones in the second filter.
Btw. I use this in a list with about 2000items, where without filtering, it is not really nice to select.
A solution would be very welcome!

@tig
Copy link
Collaborator

tig commented Dec 28, 2022

I def want to fix this!

I will get to it asap.

@MrFly72
Copy link
Author

MrFly72 commented Feb 23, 2023

Any news?
Meanwhile i get used to

  • filter
  • select
  • different filter
  • select
  • ...
  • don't forget to unfilter before enter or you loose Checked elements

@tig
Copy link
Collaborator

tig commented Feb 24, 2023

No update at this time. On my list to work on but been super busy. Sorry.

@MrFly72
Copy link
Author

MrFly72 commented Apr 12, 2023

Any news on this?

@tig
Copy link
Collaborator

tig commented Apr 28, 2023

@MrFly72, whatcha think of this?

xsK3sKz 1

The model is now:

  • The input list is truth.
  • Mark/Unmarked get applied to input.
  • The ListView always shows the filtered list + any items in the input list that were marked

Thanks to @tznind for the suggestion.

@MrFly72
Copy link
Author

MrFly72 commented Apr 28, 2023

Looks great. Can tell you how it feels when able to try.

@tig
Copy link
Collaborator

tig commented Apr 29, 2023

Putting @MrFly72's question in right thread:

One first question. How does it behave if the screen eg. Only shows 20 elements and I have already selected 18. is the scrolling area then still 20 and the pinned elements will "walk up" in the list or are place 1-18 fix with the pinned elements and only the lines 19-20 will move?

The pinned elements currently are just the top elements in the filtered list. They scroll with the list.

Making them actually be pinned (so they don't scroll) would be a big change...

andyleejordan pushed a commit that referenced this issue May 3, 2023
This addresses #174 (changing the filter caused marked items to get unmarked) by:

- The input to the cmdlet tracks marked/unmarked items
- The list attached to the listview is now always a copy of the input list, with the filter applied (even if there's no fitler).
- Whenever mark/unmark happens in the listview, the original item in the input list is updated
- On exit, any items in the input list that are marked are provided as output
@MrFly72
Copy link
Author

MrFly72 commented May 5, 2023

Hi.
I am testing in every day usage and found out, that the elements will not be on top of list, they will be in the same order, that they would have been in the "no-filtered" list:
image
Would be "nicer" if they would really be at the top. Or what do you think ?

@tig
Copy link
Collaborator

tig commented May 5, 2023

That was my intent. I'll look to see what I did wrong.

@MrFly72
Copy link
Author

MrFly72 commented May 5, 2023 via email

@tig
Copy link
Collaborator

tig commented May 5, 2023

#188 should fix this! Let me know (in that PR comments).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working OCGV
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants