Skip to content

Commit fbd3452

Browse files
committed
boxes/views: Align text in PanelSearchBox.
This commit aligns the text in PanelSearchBox to keep consistency with rest of the text in the panel. Tests updated.
1 parent c1880d8 commit fbd3452

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

tests/ui/test_ui_tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ def test_keypress_SEARCH_STREAMS(self, mocker, stream_view, key, widget_size):
576576

577577
assert stream_view.focus_index_before_search == 3
578578
stream_view.set_focus.assert_called_once_with("header")
579-
stream_view.stream_search_box.set_caption.assert_called_once_with("")
579+
stream_view.stream_search_box.set_caption.assert_called_once_with(" ")
580580

581581
@pytest.mark.parametrize("key", keys_for_command("GO_BACK"))
582582
def test_keypress_GO_BACK(self, mocker, stream_view, key, widget_size):
@@ -709,7 +709,7 @@ def test_keypress_SEARCH_TOPICS(self, mocker, topic_view, key, widget_size):
709709
topic_view.set_focus.assert_called_once_with("header")
710710
topic_view.header_list.set_focus.assert_called_once_with(2)
711711
assert topic_view.focus_index_before_search == 3
712-
topic_view.topic_search_box.set_caption.assert_called_once_with("")
712+
topic_view.topic_search_box.set_caption.assert_called_once_with(" ")
713713

714714
@pytest.mark.parametrize("key", keys_for_command("GO_BACK"))
715715
def test_keypress_GO_BACK(self, mocker, topic_view, key, widget_size):
@@ -1132,7 +1132,7 @@ def test_keypress_SEARCH_PEOPLE(self, right_col_view, mocker, key, widget_size):
11321132
mocker.patch.object(right_col_view.user_search, "set_caption")
11331133
right_col_view.keypress(size, key)
11341134
right_col_view.set_focus.assert_called_once_with("header")
1135-
right_col_view.user_search.set_caption.assert_called_once_with("")
1135+
right_col_view.user_search.set_caption.assert_called_once_with(" ")
11361136

11371137
@pytest.mark.parametrize("key", keys_for_command("GO_BACK"))
11381138
def test_keypress_GO_BACK(self, right_col_view, mocker, key, widget_size):

tests/ui_tools/test_boxes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ def test_write_box_header_contents(
12461246

12471247

12481248
class TestPanelSearchBox:
1249-
search_caption = "Search Results "
1249+
search_caption = " Search Results "
12501250

12511251
@pytest.fixture
12521252
def panel_search_box(self, mocker):
@@ -1257,7 +1257,7 @@ def panel_search_box(self, mocker):
12571257
return PanelSearchBox(panel_view, "UNTESTED_TOKEN", update_func)
12581258

12591259
def test_init(self, panel_search_box):
1260-
assert panel_search_box.search_text == "Search [X]: "
1260+
assert panel_search_box.search_text == " Search [X]: "
12611261
assert panel_search_box.caption == panel_search_box.search_text
12621262
assert panel_search_box.edit_text == ""
12631263

zulipterminal/ui_tools/boxes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ def __init__(
17611761
) -> None:
17621762
self.panel_view = panel_view
17631763
self.search_command = search_command
1764-
self.search_text = f"Search [{', '.join(keys_for_command(search_command))}]: "
1764+
self.search_text = f" Search [{', '.join(keys_for_command(search_command))}]: "
17651765
self.search_error = urwid.AttrMap(
17661766
urwid.Text([" ", INVALID_MARKER, " No Results"]), "search_error"
17671767
)
@@ -1796,7 +1796,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
17961796
self.panel_view.keypress(size, "esc")
17971797
elif is_command_key("ENTER", key) and not self.panel_view.empty_search:
17981798
self.panel_view.view.controller.exit_editor_mode()
1799-
self.set_caption([("filter_results", "Search Results"), " "])
1799+
self.set_caption([("filter_results", " Search Results "), " "])
18001800
self.panel_view.set_focus("body")
18011801
if hasattr(self.panel_view, "log"):
18021802
self.panel_view.body.set_focus(0)

zulipterminal/ui_tools/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
367367
if is_command_key("SEARCH_STREAMS", key):
368368
_, self.focus_index_before_search = self.log.get_focus()
369369
self.set_focus("header")
370-
self.stream_search_box.set_caption("")
370+
self.stream_search_box.set_caption(" ")
371371
return key
372372
elif is_command_key("GO_BACK", key):
373373
self.stream_search_box.reset_search_text()
@@ -479,7 +479,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
479479
_, self.focus_index_before_search = self.log.get_focus()
480480
self.set_focus("header")
481481
self.header_list.set_focus(2)
482-
self.topic_search_box.set_caption("")
482+
self.topic_search_box.set_caption(" ")
483483
return key
484484
elif is_command_key("GO_BACK", key):
485485
self.topic_search_box.reset_search_text()
@@ -753,7 +753,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
753753
if is_command_key("SEARCH_PEOPLE", key):
754754
self.allow_update_user_list = False
755755
self.set_focus("header")
756-
self.user_search.set_caption("")
756+
self.user_search.set_caption(" ")
757757
return key
758758
elif is_command_key("GO_BACK", key):
759759
self.user_search.reset_search_text()

0 commit comments

Comments
 (0)