Skip to content

Commit

Permalink
boxes: Shrink left of message by using unicode to mark edited messages.
Browse files Browse the repository at this point in the history
By moving from 'EDITED' to '✎……' we avoid having a distracting label to
the left of the message, and can shrink wasted space to the left of the
message.

This commit reduces the space to the left by 3.

Based on a suggestion by Tim Abbott.
  • Loading branch information
neiljp committed May 11, 2020
1 parent a69c421 commit cc4c823
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/ui/test_ui_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1889,17 +1889,17 @@ def test_main_view_compact_output(self, mocker, message_fixture,
assert len(view_components) == 1
assert isinstance(view_components[0], Padding)

def test_main_view_generates_EDITED_label(self, mocker,
messages_successful_response):
def test_main_view_generates_edited_message_label(
self, mocker, messages_successful_response):
messages = messages_successful_response['messages']
for message in messages:
self.model.index['edited_messages'].add(message['id'])
msg_box = MessageBox(message, self.model, message)
view_components = msg_box.main_view()

label = view_components[0].original_widget.contents[0]
assert label[0].text == 'EDITED'
assert label[1][1] == 7
assert label[0].text == '✎……'
assert label[1][1] == 4

@pytest.mark.parametrize('key', keys_for_command('EDIT_MESSAGE'))
@pytest.mark.parametrize(['to_vary_in_each_message',
Expand Down
8 changes: 4 additions & 4 deletions zulipterminal/ui_tools/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,16 +629,16 @@ def main_view(self) -> List[Any]:
content = self.transform_content()

if self.message['id'] in self.model.index['edited_messages']:
edited_label_size = 7
edited_label_size = 4
left_padding = 1
else:
edited_label_size = 0
left_padding = 8
left_padding = 5

edit_mark = '\N{LOWER RIGHT PENCIL}' + (2 * '\N{HORIZONTAL ELLIPSIS}')
content = urwid.Padding(
urwid.Columns([
(edited_label_size,
urwid.Text('EDITED')),
(edited_label_size, urwid.Text(edit_mark)),
urwid.LineBox(
urwid.Columns([
(1, urwid.Text('')),
Expand Down

0 comments on commit cc4c823

Please sign in to comment.