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

keep track of hidden items #74

Merged

Conversation

kalikaneko
Copy link
Contributor

This addresses bug described in #72

@kalikaneko
Copy link
Contributor Author

this includes #70, I can rebase when that gets merged.

for i, itemval := range t.visibleItems {
if uint32(val) == itemval {
newvisible := append(t.visibleItems[:i], t.visibleItems[i+1:]...)
t.visibleItems = newvisible
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the compiler will produce the same code, but AFAIK the go style is to assign it in the append:

t.visibleItems = append(t.visibleItems[:i], t.visibleItems[i+1:]...)

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you can break here.

@kalikaneko kalikaneko force-pushed the bug/keep-track-of-hidden-items-win branch from 1c715a8 to b8beec1 Compare November 14, 2018 19:37
in windows, Hide() destroys a menuItem. this has problems when later we
try to Show() it and end up using the original menuID, for instance if
we did hide several elements in a row: if we insert the element in the
original position, it will end up inserted past some other elements that
were intended to be placed after the items that were hidden.

by keeping a slice where we insert and delete the id of the elements
that are shown, we can sort this slice and take the index of a given
element as the correct index in which we want to insert the menuItem
when calling Show() again.

- Resolves: getlantern#72
@kalikaneko kalikaneko force-pushed the bug/keep-track-of-hidden-items-win branch from b8beec1 to f5df9ef Compare November 14, 2018 19:42
@joesis joesis merged commit 6fa49ab into getlantern:master Nov 25, 2018
@getlantern getlantern deleted a comment from joesis Mar 1, 2021
@getlantern getlantern deleted a comment from joesis Mar 1, 2021
ropog3ovomou pushed a commit to ropog3ovomou/systray that referenced this pull request Jul 13, 2022
…dden-items-win

keep track of hidden items
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.

None yet

3 participants