Skip to content

___Fix focus index before and after search #976

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

Closed
wants to merge 1 commit into from

Conversation

Rohitth007
Copy link
Collaborator

@Rohitth007 Rohitth007 commented Apr 1, 2021

This PR corrects what the code for focus_index_before_search was intended to do. See #975
The focus index was still being updated even in the search results.

This is fixed by adding a boolean in_search_mode which does not
call get_focus untill the search is over. Slight reordering was
done in __init__ to fit the boolean in an ideal place w.r.t.
readability.

Fixes #975

Before Commit: After Commit:
wrong-focus right-focus

@zulipbot zulipbot added size: M [Automatic label added by zulipbot] bug: crash labels Apr 1, 2021
@zulipbot
Copy link
Member

zulipbot commented Apr 1, 2021

ERROR: Label "PR review needed" does not exist and was thus not added to this pull request.

@Rohitth007
Copy link
Collaborator Author

@zulipbot add "PR needs review"

@zulipbot zulipbot added the PR needs review PR requires feedback to proceed label Apr 1, 2021
@neiljp
Copy link
Collaborator

neiljp commented Apr 1, 2021

@Rohitth007 I gave this a quick try and I agree that this resolves the issue. However, as per my message on the stream, I'd prefer to block the user from entering into an empty list, which is what we currently allow and the PR appears to continue to allow, but working around the bug?

I'm certainly open to merging something like this if we have no other work on the bug prior to a release, but I'd also prefer to see the improved UI instead as it's much less confusing for the user.

@neiljp neiljp removed the PR needs review PR requires feedback to proceed label Apr 1, 2021
@Rohitth007
Copy link
Collaborator Author

@neiljp yes that can be done, but should I open another PR for this as making that change makes this PR ineffective for this bug but solves the issue in #975.
Also there are a few refactors that can be done in StreamView and TopicView should I do them in a separate PR?

@Rohitth007 Rohitth007 changed the title bugfix: view: Fix Zulip crash during search. Fixes focus index before and after search Apr 2, 2021
@Rohitth007 Rohitth007 changed the title Fixes focus index before and after search Fixes focus_index_before and after search Apr 2, 2021
@Rohitth007 Rohitth007 changed the title Fixes focus_index_before and after search Fixes focus index before and after search Apr 2, 2021
@Rohitth007
Copy link
Collaborator Author

@neiljp I have done it using the method you advised and moved it to PR #977

@Rohitth007 Rohitth007 changed the title Fixes focus index before and after search Fix focus index before and after search Apr 2, 2021
This commit corrects what the code for focus_index_before_search was
intended to do. The focus index was still being updated even in the
search results.

This is fixed by adding a boolean `in_search_mode` which does not
call `get_focus` untill the search is over. Slight reordering was
done in `__init__` to fit the boolean in an ideal place w.r.t.
readability.

Fixes zulip#975
@Rohitth007 Rohitth007 force-pushed the search-mode-bug-#923 branch from b1012d9 to 0868e44 Compare April 2, 2021 12:16
@Rohitth007 Rohitth007 closed this Apr 2, 2021
@Rohitth007 Rohitth007 deleted the search-mode-bug-#923 branch April 2, 2021 13:31
@Rohitth007 Rohitth007 restored the search-mode-bug-#923 branch April 2, 2021 13:36
@Rohitth007 Rohitth007 deleted the search-mode-bug-#923 branch April 2, 2021 13:37
@Rohitth007 Rohitth007 changed the title Fix focus index before and after search ___Fix focus index before and after search Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: crash size: M [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Focus_Index_Before_Search doesn't work as intended
3 participants