Skip to content

Pressing d twice requires q twice to exit#826

Merged
Rigellute merged 5 commits into
Rigellute:masterfrom
cobbinma:multiple-d-clicks
Aug 23, 2021
Merged

Pressing d twice requires q twice to exit#826
Rigellute merged 5 commits into
Rigellute:masterfrom
cobbinma:multiple-d-clicks

Conversation

@cobbinma
Copy link
Copy Markdown
Contributor

@cobbinma cobbinma commented Jun 1, 2021

Hi guys 👋,

First attempt at a PR here and attempted to resolve issue

Did this by deduping any routes on the navigation stack with matching ids.


The device selector popup can be opened multiple times by pressing d more than once.
To get back to the main menu, each of these needs to be closed separately by pressing q the same number of times.

It would be nicer if pressing q only once always goes back to the main menu.

E.g, actual behavior:

press d
press d
press q
You're seeing the device selector
expected behavior:

press d
press d
press q
You're seeing the main menu

Comment thread src/app.rs Outdated
}

pub fn pop_navigation_stack(&mut self) -> Option<Route> {
self.navigation_stack.dedup_by(|a, b| a.id == b.id);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think it would be just a bit nicer to do this in push_navigation_stack, assuming that that is the only place where the stack is stack is grown. In that case, it could possibly be just an if statement checking whether the current id is the same as the id at the top of the stack.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks for looking at this 👍 moved to push_navigation_stack and changed to if statement.

Copy link
Copy Markdown
Owner

@Rigellute Rigellute left a comment

Choose a reason for hiding this comment

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

Nice, looks good!

Thank you 👏

@Rigellute Rigellute merged commit eba6390 into Rigellute:master Aug 23, 2021
@Rigellute
Copy link
Copy Markdown
Owner

@all-contributors please add @cobbinma for code

@allcontributors
Copy link
Copy Markdown
Contributor

@Rigellute

I've put up a pull request to add @cobbinma! 🎉

nighi pushed a commit to nighi/spotify-tui that referenced this pull request Jul 11, 2025
* dedup selected device routes from nav stack

* dedup any matching routes from nav stack

* catch duplicate route id on push

* remove return

* remove id from variable name
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.

Pressing d twice requires q twice to exit

3 participants