Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Maintain position in topic list when toggling topic list (issue #617) #1275

Closed
wants to merge 5 commits into from

Conversation

Subhasish-Behera
Copy link
Contributor

@Subhasish-Behera Subhasish-Behera commented Dec 9, 2022

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 presses t 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 to TopicsView 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 and stream_id to def stream_view which is used to create stream_btn_list according to the changes made in the StreamButton class in buttons.py.
buttons.py
StreamButton
->Adding a parameter called curr_topic_name to class StreamButton
->def keypress of StreamButton: passes the curr_topic_name to TopicView so that, curr_topic_name can be focussed while rendering that stream's TopicView
TopicButton
->def keypress of TopicButton: passes the topic_name and stream_id of the Topicbutton from where t 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).

->The implementation can be divided into 2 parts
	1.passing the topic-name to TopicsView , so that it can focus on
	  that widget
	2. introducing a parameter called curr_topic_name which stores
	   the last focussed topic's name and then passes it to
	   appropriate function during keypress of "TOGGLE_TOPIC" KEY
->This commit 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
topic which was last focussed.
@zulipbot zulipbot added the size: L [Automatic label added by zulipbot] label Dec 9, 2022
@Subhasish-Behera
Copy link
Contributor Author

This PR is opened to discuss #617

Subhasish-Behera and others added 3 commits December 19, 2022 13:16
changed stream.id to stream["id"] to iterate over view.unpinned_streams and view.pinned_streams.
@Subhasish-Behera
Copy link
Contributor Author

@neiljp Can you please give some feedback on the changes I have made?

@Subhasish-Behera Subhasish-Behera deleted the toggle_topic branch February 24, 2023 14:30
@Subhasish-Behera Subhasish-Behera restored the toggle_topic branch February 24, 2023 14:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
size: L [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants