Maintain position in topic list when toggling topic list (issue #617) #1275
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the current changes, this PR solves the issue partially.
What it solves?
-> it solves the maintaining of focus of the topic list of a stream( say stream 1) from where the
t
button was pressed.But if the user presses
t
for some stream button (stream 2) and once again pressest
for stream 1 then the focus of the topic list resets to the top.-> In other words, pressing 't' multiple times on the same stream button would maintain the focus.
-> This PR is based on the idea that just like a topic is always
coupled with a stream, a stream can also be coupled with a particular
a topic that was last focussed.
The code changes done are
views.py
TopicsView:
-> Introducing a parameter
curr_topic_name
toTopicsView
that stores the topic name of the last focussed topic in a stream. (This would make the implementation work even if the topic list is rearranged as it depends on topic_name not the pos on the list)LeftColumnView:
->adding parameters
topic_name
andstream_id
to defstream_view
which is used to createstream_btn_list
according to the changes made in theStreamButton
class in buttons.py.buttons.py
StreamButton
->Adding a parameter called
curr_topic_name
to classStreamButton
->def
keypress
ofStreamButton
: passes the curr_topic_name to TopicView so that, curr_topic_name can be focussed while rendering that stream's TopicViewTopicButton
->def
keypress
ofTopicButton
: passes the topic_name and stream_id of the Topicbutton from wheret
was pressed to show_stream_view.Further suggestions would be required to make changes outside of UI files to store the state(which could solve the remaining part of the issue).