Skip to content

Keep autocomplete from stealing editor focus#13

Open
apples-kksk wants to merge 1 commit into
Mudlet:masterfrom
apples-kksk:apples/autocomplete-no-focus-steal
Open

Keep autocomplete from stealing editor focus#13
apples-kksk wants to merge 1 commit into
Mudlet:masterfrom
apples-kksk:apples/autocomplete-no-focus-steal

Conversation

@apples-kksk
Copy link
Copy Markdown

Addresses Mudlet/Mudlet#5310.
/claim Mudlet/Mudlet#5310

Summary:

  • keep the editor component as the focused widget while autocomplete is visible
  • make the autocomplete menu/list non-focus widgets and avoid activating the popup window
  • route editor-origin navigation keys to the autocomplete list, while normal typing/backspace continues through the editor
  • preserve legacy popup/list key handling with a recursion guard for forwarded events
  • avoid calling editorComponentRef_->setFocus() on close, so autocomplete does not reclaim focus from another non-edbee widget
  • add focused regression tests for editor focus, list-origin key forwarding, arrow navigation, completion acceptance, full-word Enter fall-through, Escape cancellation, and external-widget focus preservation

This is intentionally different from #11: it removes the known focus-grabbing path instead of restoring editor focus after the popup closes. It is similar in implementation direction to #12, but adds broader coverage for the focus and key-routing behavior.

Proof:

Autocomplete focus proof

The proof GIF is generated from the actual edbee widget. It shows autocomplete opening without list focus, Down arrow changing the list selection, typing continuing into the editor, list-origin text keys routing back to the editor, Escape closing autocomplete, and closing autocomplete without stealing focus from another widget.

Verification:

  • git diff --check
  • cmake -S . -B build/codex-qt6 -DCMAKE_BUILD_TYPE=Debug
  • cmake --build build/codex-qt6 --parallel 6
  • QT_FORCE_STDERR_LOGGING=1 QT_MESSAGE_PATTERN='%{message}' QT_QPA_PLATFORM=offscreen ./build/codex-qt6/edbee-test/edbee-test (815 passed, 0 failures)

Follow-up:

  • after this lands, Mudlet/Mudlet still needs a submodule-pointer PR for 3rdparty/edbee-lib so Mudlet builds include the edbee-lib fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant