diff --git a/tests/ui_tools/test_buttons.py b/tests/ui_tools/test_buttons.py index 72ac678273..e3e5463b9c 100644 --- a/tests/ui_tools/test_buttons.py +++ b/tests/ui_tools/test_buttons.py @@ -336,11 +336,11 @@ def test_keypress_emoji_button( class TestTopicButton: @pytest.mark.parametrize( - "count, stream_id, title, stream_name", + "count, stream_id, title, stream_name, is_resolved", [ - (2, 86, "topic1", "Django"), - (1, 14, "topic2", "GSoC"), - (1000, 205, "topic3", "PTEST"), + (2, 86, "topic1", "Django", False), + (1, 14, "✔ topic2", "GSoC", True), + (1000, 205, "topic3", "PTEST", False), ], ) def test_init_calls_top_button( @@ -350,6 +350,7 @@ def test_init_calls_top_button( title: str, stream_id: int, stream_name: str, + is_resolved: bool, ) -> None: controller = mocker.Mock() controller.model.stream_dict = { @@ -367,8 +368,8 @@ def test_init_calls_top_button( ) top_button.assert_called_once_with( - caption=title, - prefix_character="", + caption=title if not is_resolved else title[2:], + prefix_character=" " if not is_resolved else title[:1], show_function=mocker.ANY, # partial count_style="unread_count", **params, diff --git a/zulipterminal/api_types.py b/zulipterminal/api_types.py index 817d87f5b8..99c951f0cc 100644 --- a/zulipterminal/api_types.py +++ b/zulipterminal/api_types.py @@ -3,6 +3,7 @@ from typing_extensions import Literal, TypedDict +RESOLVED_PREFIX = "✔" EditPropagateMode = Literal["change_one", "change_all", "change_later"] EmojiType = Literal["realm_emoji", "unicode_emoji", "zulip_extra_emoji"] # Limited flags which could be present in update_message_flag events. diff --git a/zulipterminal/config/ui_sizes.py b/zulipterminal/config/ui_sizes.py index 010ac0a64a..941dd451ef 100644 --- a/zulipterminal/config/ui_sizes.py +++ b/zulipterminal/config/ui_sizes.py @@ -1,3 +1,3 @@ TAB_WIDTH = 3 -LEFT_WIDTH = 27 +LEFT_WIDTH = 29 RIGHT_WIDTH = 23 diff --git a/zulipterminal/ui_tools/buttons.py b/zulipterminal/ui_tools/buttons.py index db9194ba3a..cf8bc37296 100644 --- a/zulipterminal/ui_tools/buttons.py +++ b/zulipterminal/ui_tools/buttons.py @@ -6,7 +6,7 @@ import urwid from typing_extensions import TypedDict -from zulipterminal.api_types import EditPropagateMode +from zulipterminal.api_types import RESOLVED_PREFIX, EditPropagateMode from zulipterminal.config.keys import is_command_key, primary_key_for_command from zulipterminal.config.regexes import REGEX_INTERNAL_LINK_STREAM_ID from zulipterminal.config.symbols import ( @@ -297,11 +297,19 @@ def __init__( stream_name=self.stream_name, topic_name=self.topic_name, ) + + # The space acts as a TopButton prefix and gives an effective 3 spaces for unresolved topics. + topic_prefix = " " + topic_name = self.topic_name + if self.topic_name.startswith(RESOLVED_PREFIX + " "): + topic_prefix = self.topic_name[:1] + topic_name = self.topic_name[2:] + super().__init__( controller=controller, - caption=self.topic_name, + caption=topic_name, show_function=narrow_function, - prefix_character="", + prefix_character=topic_prefix, count=count, count_style="unread_count", )