Skip to content
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

findController.nextMatch() works only, if the editor does not have the focus #17

Open
TomKrauss opened this issue Apr 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@TomKrauss
Copy link

Describe the bug
findController.nextMatch() works only, if the editor does not have the focus. This makes it impossible to implement the following feature: pressing some kind of shortcut to jump to the next match while editing the text (like Ctrl+K in IntelliJ) won't work.

To Reproduce

  1. Add a shortcut to the editor which is bound to an Intent triggering a findController.nextMatch().
  2. Perform a find operation
  3. Set the focus on the editor and press the named shortcut from 1
  4. Nothing happens

Expected behavior
We should navigate to the next match in that case.

Analysis
The reason nothing works is the following code:

/// File _code_editable.dart
  void _onCodeFindChanged() {
    final CodeFindValue? value = widget.findController.value;
    if (value == null) {
      widget.focusNode.requestFocus();
      return;
    }
/// -> prevents further processing. Why is this check necessary? Is it to avoid unintended onCodeFindChanged actions? Can we
/// avoid those using a different check?
    if (widget.focusNode.hasFocus) {
      return;
    }

Device:

  • OS: Windows Desktop
@TomKrauss TomKrauss added the bug Something isn't working label Apr 21, 2024
@MegatronKing
Copy link
Contributor

When you open the find panel and focus on find keyword input field, the editor will lose the focus. The shortcuts should bind to the focus of keyword input field rather than the editor.

@TomKrauss
Copy link
Author

Thank you very much for the clarification. I had another use case in mind (the user wants to step on to the next search result, when the find panel is closed). I found a work around in the meanwhile however to implement this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants