Skip to content

[Bug] Order of "find next" messed up: 1 -> 3 -> 4 -> 2 -> 4 -> 1 #251

@GfEW

Description

@GfEW

There is a bug in Editor v. 1.96 that confuses search order when Enter on a physical keyboard is pressed in the search widget multiple times to find next occurrences. This 42 byte text file contains four occurrences of '[[' which should be found in order, but are not: editor_v-1-96_find-results-order-bug_demo_20250401.txt

Affected devices: diverse; with physical keyboard
Architecture: armeabi-v7a, arm64-v8a
Android version: 9 to 11
Editor version: 1.96 (F-Droid)

How to reproduce the bug

  1. Open editor_v-1-96_find-results-order-bug_demo_20250401.txt in Editor
    1.a. Optional: press Ctrl+E to enter edit mode (if only to show it doesn't matter)
  2. Press Ctrl+F to open the search widget
  3. Enter the four character string \[\[ into the search line
    3.1. Press Enter once, note which match is highlighted
    3.2. Press Enter again, note which match is highlighted
    3.3. Press Enter again, note which match is highlighted
    3.4. Press Enter again, note which match is highlighted
    3.5. Press Enter again, note which match is highlighted
    3.6. Press Enter again, note which match is highlighted

What should happen?

  • Step 3.1. should find '[[first]]'
  • Step 3.2. should find '[[second]]'
  • Step 3.3. should find '[[third]]'
  • Step 3.4. should find '[[fourth]]'
  • Step 3.5. should find '[[first]]' (overwrapped, possibly after another press of Enter)
  • Step 3.6. should find '[[second]]' (overwrapped)

What does happen instead?

  • Step 3.1. finds '[[first]]'
  • Step 3.2. finds '[[third]]'
  • Step 3.3. finds '[[fourth]]'
  • Step 3.4. finds '[[second]]'
  • Step 3.5. finds '[[fourth]]'
  • Step 3.6. finds '[[first]]'

Additional remarks

  • Note that for many, pressing Enter in the search widget is the default keyboard way to get to search results beyond the first occurrence. Also, Enter serves as a fallback on keyboards where you can't type Ctrl+Alt+F nor F3.
  • For a physical keyboard to trigger the bug, it doesn't seem to matter whether it is externally connected (via USB or bluetooth), or built-in.
  • I couldn't reproduce the bug on the soft keyboards tested so far (that's Unexpected Keyboard, Fossify's Simple Keyboard, and Hacker's Keyboard).

NOTE: Should you think this bug resides upstream, please let me know where, and I'll happily report it there. Thank you!

EDIT 20250402: Apparently, this only occurs with a physical keyboard! I've updated the above description accordingly.

EDIT 20250423: Possibly related: https://stackoverflow.com/questions/4513888/enter-key-on-edittext-hitting-onkey-twice

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions