-
-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Disable cycling while editing a PM #1280
base: main
Are you sure you want to change the base?
Changes from 1 commit
b45eb77
7cfffe0
cdb0fad
415f31f
2a66b5d
691296d
f1590cb
ba32129
40e6067
ac20ad7
2bd5228
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,15 +178,40 @@ def send_stop_typing_status(self) -> None: | |
self.idle_status_tracking = False | ||
self.sent_start_typing_status = False | ||
|
||
def _setup_common_private_compose(self) -> None: | ||
self.set_editor_mode() | ||
|
||
self.compose_box_status = "open_with_private" | ||
|
||
self.msg_write_box = ReadlineEdit( | ||
multiline=True, max_char=self.model.max_message_length | ||
) | ||
self.msg_write_box.enable_autocomplete( | ||
func=self.generic_autocomplete, | ||
key=primary_key_for_command("AUTOCOMPLETE"), | ||
key_reverse=primary_key_for_command("AUTOCOMPLETE_REVERSE"), | ||
) | ||
self.msg_write_box.set_completer_delims(DELIMS_MESSAGE_COMPOSE) | ||
|
||
self.header_write_box = urwid.Columns([self.to_write_box]) | ||
header_line_box = urwid.Pile( | ||
[ | ||
urwid.Divider(COMPOSE_HEADER_TOP), | ||
self.header_write_box, | ||
urwid.Divider(COMPOSE_HEADER_BOTTOM), | ||
] | ||
) | ||
self.contents = [ | ||
(header_line_box, self.options()), | ||
(self.msg_write_box, self.options()), | ||
] | ||
self.focus_position = self.FOCUS_CONTAINER_MESSAGE | ||
|
||
def private_box_view( | ||
self, | ||
*, | ||
recipient_user_ids: Optional[List[int]] = None, | ||
) -> None: | ||
self.set_editor_mode() | ||
|
||
self.compose_box_status = "open_with_private" | ||
|
||
if recipient_user_ids: | ||
self._set_regular_and_typing_recipient_user_ids(recipient_user_ids) | ||
self.recipient_emails = [ | ||
|
@@ -212,31 +237,7 @@ def private_box_view( | |
key_reverse=primary_key_for_command("AUTOCOMPLETE_REVERSE"), | ||
) | ||
self.to_write_box.set_completer_delims("") | ||
|
||
self.msg_write_box = ReadlineEdit( | ||
multiline=True, max_char=self.model.max_message_length | ||
) | ||
self.msg_write_box.enable_autocomplete( | ||
func=self.generic_autocomplete, | ||
key=primary_key_for_command("AUTOCOMPLETE"), | ||
key_reverse=primary_key_for_command("AUTOCOMPLETE_REVERSE"), | ||
) | ||
self.msg_write_box.set_completer_delims(DELIMS_MESSAGE_COMPOSE) | ||
|
||
self.header_write_box = urwid.Columns([self.to_write_box]) | ||
header_line_box = urwid.Pile( | ||
[ | ||
urwid.Divider(COMPOSE_HEADER_TOP), | ||
self.header_write_box, | ||
urwid.Divider(COMPOSE_HEADER_BOTTOM), | ||
] | ||
) | ||
self.contents = [ | ||
(header_line_box, self.options()), | ||
(self.msg_write_box, self.options()), | ||
] | ||
self.focus_position = self.FOCUS_CONTAINER_MESSAGE | ||
|
||
self._setup_common_private_compose() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To improve readability later, it may be useful to regroup lines in this function, since we're eventually going to have
In particular, we have part of the last bullet oddly above this line (send_next_typing_update) and not with the related code. Once the code is simplified, it'd also be good if that was naturally further down, and each group separated by a blank line. In the edit version you can do any grouping when you introduce it; for this function I'll leave you to decide where to add/leave blank lines and move the line I mentioned, but eg. you delete a blank line in this commit, that could separate where the new function is from the 'timedelta' lines below. |
||
start_period_delta = timedelta(seconds=TYPING_STARTED_WAIT_PERIOD) | ||
stop_period_delta = timedelta(seconds=TYPING_STOPPED_WAIT_PERIOD) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.to_write_box
is not defined in this method. Rather than needing to assume that when we call this function that it does, we can require that it does, by passing it into the function.I've not checked, but the equivalent stream function could benefit from a similar refactor.