Skip to content

Conversation

Rohitth007
Copy link
Collaborator

@Rohitth007 Rohitth007 commented Jul 8, 2021

What does this PR do?
Currently only contains prep commits that help with both Panel refactor and keypress refactor.

Tested?

  • Manually
  • Existing tests (adapted, if necessary)
  • Passed linting & tests (each commit)

Commit flow

  • Commit 1: refactor: ui/views: Move enter_editor_mode closer to search box.
  • Commit 2: refactor: ui: Simplify key redirection to directly return key.
  • Commit 3: refactor: view: Group related lines together in init.

Notes & Questions

It would be useful to merge the first two.

Interactions

This commit moves `enter_editor_mode` into the Stream/Topic/
RightColumnView's keypress so that View is left to handle only focus
and autohide features.

This helps with refactoring Panel later.

Tests updated.
This commit:
* replaces user_view with right_column to make it
similar to left_column.keypress in SEARCH_STREAMS/TOPICS
* returns middle_column.keypress(), left_column.keypress() and
right_column.keypress() to directly return handled/unhandled keys.
To improve readability in `__init__` method of StreaView and
TopicView, related variables were grouped together using comments.
@zulipbot zulipbot added the size: L [Automatic label added by zulipbot] label Jul 16, 2021
@Rohitth007 Rohitth007 requested a review from neiljp July 16, 2021 15:23
@zulipbot
Copy link
Member

Heads up @Rohitth007, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/main branch and resolve your pull request's merge conflicts accordingly.

Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rohitth007 I've just resolved a conflict from the test-typing changes and merged the first commit - it's a very nice tidy, moving the action closer to the data 👍
(also avoiding that conditional just by knowing which state we're in!)

For the second commit, there's renaming and the moving to a direct return of the key - is the latter intended to help towards the keypress-flow restructuring? There's no mention of that, but the style isn't mentioned with that (or anything else) in mind, so I wasn't clear.

I've not resolved the conflicts in the second commit onwards; it looks like there still may be a need to improve the patching in the new version like in the old one, now that we're checking the types? (@prah23 ?)

@@ -292,7 +290,7 @@ def test_keypress_autohide_users(self, view, mocker, autohide, key, widget_size)

view.keypress(size, key)

view.users_view.keypress.assert_called_once_with(size, key)
view.right_panel.keypress.assert_called_once_with(size, key)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing users_view with right_panel seems good naming here, though the commit text doesn't indicate the same name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I change that right away.

@neiljp neiljp added PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback and removed PR needs review PR requires feedback to proceed labels Jul 21, 2021
@Rohitth007
Copy link
Collaborator Author

Rohitth007 commented Jul 21, 2021

@neiljp Re second commit, it definitely helps with the keypress refactoring by allowing the return of unhandled keys back to urwid in the end but it doesn't directly affect the functionality in that PR as this is the outer most widget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: refactoring has conflicts PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback size: L [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants