Skip to content

Commit d3251f2

Browse files
rsashankneiljp
authored andcommitted
refactor: boxes: Extract exit compose box logic into a new method.
1 parent 66c74ba commit d3251f2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

zulipterminal/ui_tools/boxes.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,12 @@ def autocomplete_emojis(
709709

710710
return emoji_typeahead, emojis
711711

712+
def exit_compose_box(self) -> None:
713+
self._set_compose_attributes_to_defaults()
714+
self.view.controller.exit_editor_mode()
715+
self.main_view(False)
716+
self.view.middle_column.set_focus("body")
717+
712718
def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
713719
if self.is_in_typeahead_mode and not (
714720
is_command_key("AUTOCOMPLETE", key)
@@ -800,10 +806,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
800806
)
801807
elif is_command_key("EXIT_COMPOSE", key):
802808
self.send_stop_typing_status()
803-
self._set_compose_attributes_to_defaults()
804-
self.view.controller.exit_editor_mode()
805-
self.main_view(False)
806-
self.view.middle_column.set_focus("body")
809+
self.exit_compose_box()
807810
elif is_command_key("MARKDOWN_HELP", key):
808811
self.view.controller.show_markdown_help()
809812
return key

0 commit comments

Comments
 (0)