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

Fixes #174. Changing Filter does not undo previously marked items #186

Merged
merged 71 commits into from
May 3, 2023

Conversation

tig
Copy link
Collaborator

@tig tig commented Apr 28, 2023

PR Summary

Fixes #174.

PR Context

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

tig and others added 30 commits March 11, 2020 15:55
@SteveL-MSFT SteveL-MSFT requested a review from andyleejordan May 2, 2023 13:41
Copy link
Member

@andyleejordan andyleejordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty great! Just some small style fixes (sorry) and a question on the disposability of GridViewDataSource.

src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Outdated Show resolved Hide resolved

if (_listViewSource != null) {
_listViewSource.MarkChanged -= ListViewSource_MarkChanged;
_listViewSource = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting that I think we're relying on the garbage collector to dispose of the previously created _listViewSource here. I think that's fine? If _listViewSource is disposable, we should do that. I'm not sure if it is though...will find out soon I guess.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok we're good! It is not Disposable, it's an implementation of IListDataSource (which is a simple interface with just primitives and methods) and it holds a List<GridViewRow> which is managed only and thus not disposable.

src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs Outdated Show resolved Hide resolved
@andyleejordan andyleejordan merged commit d2d08de into PowerShell:master May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OCGV:Different Filter will "forget" all selected before
2 participants