Skip to content

Commit

Permalink
boxes: Use styled space in recipient header between recipients and line.
Browse files Browse the repository at this point in the history
This improves consistency between how private and stream message
recipient headers are shown.

For private messages, this avoids the space being spuriously highlighted
(selected) when the message underneath is selected, as a separate space
in the columns was not previously styled.

For stream messages, this ensures that the stream/topic text is
separated from the line/bar by a space, if it wraps onto a second line;
previously the space was part of the stream/topic text.

Tests amended.
  • Loading branch information
neiljp committed May 26, 2020
1 parent 6ab45cc commit a6c686b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/ui/test_ui_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,8 @@ def test_main_view_generates_stream_header(self, mocker, message,
assert isinstance(view_components[0], Columns)

assert isinstance(view_components[0][0], Text)
assert isinstance(view_components[0][1], Divider)
assert isinstance(view_components[0][1], Text)
assert isinstance(view_components[0][2], Divider)

@pytest.mark.parametrize('message', [
{
Expand Down
5 changes: 3 additions & 2 deletions zulipterminal/ui_tools/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,12 @@ def stream_header(self) -> Any:
stream_title_markup = ('bar', [
(bar_color, '{} {} '.format(self.stream_name,
stream_topic_separator)),
('title', ' {} '.format(self.topic_name))
('title', ' {}'.format(self.topic_name))
])
stream_title = urwid.Text(stream_title_markup)
header = urwid.Columns([
('pack', stream_title),
(1, urwid.Text((color, ' '))),
urwid.AttrWrap(urwid.Divider('━'), color),
])
header.markup = stream_title_markup
Expand All @@ -305,7 +306,7 @@ def private_header(self) -> Any:
title = urwid.Text(title_markup)
header = urwid.Columns([
('pack', title),
(1, urwid.Text(' ')),
(1, urwid.Text(('general_bar', ' '))),
urwid.AttrWrap(urwid.Divider('━'), 'general_bar'),
])
header.markup = title_markup
Expand Down

0 comments on commit a6c686b

Please sign in to comment.