michael-lazar / rtv

Browse Reddit from your terminal
MIT License
4.64k stars 274 forks source link

Implement a proper return key (fixes #689) #691

Open goggle opened 5 years ago

goggle commented 5 years ago

This PR implements a proper return key as proposed in issue #689. As a consequence of that, the former (IMO rather complicated) approach of using the methods loop and handle_selected_page is replaced by using a simple page stack to keep track of the currently selected page. This page stack also defines a maximal size: If the page stack is full and an additional page is added to the page stack, the oldest entry in the page stack will be removed, so that the page stack does not exceed the maximal size.

For this new approach, the tests had to be adjusted. Here is a summary:

Removed tests (no longer needed or replaced by the newly added tests):

Modified tests:

Added tests: