Skip to content

Fix emoji suggestions: show last in panel, never auto-select - #13

Open
iamshakibali wants to merge 1 commit into
ARahim3:mainfrom
iamshakibali:fix/emoji-suggestion-order-and-selection
Open

iamshakibali wants to merge 1 commit into
ARahim3:mainfrom
iamshakibali:fix/emoji-suggestion-order-and-selection

Conversation

@iamshakibali

Copy link
Copy Markdown

Problem

While typing, emoji candidates from the riti engine were (a) shown at the front of the candidate panel and (b) auto-selected as the default — so pressing space would commit an emoji instead of the relevant word.

Changes (Lekho/Sources/InputController.swift)

  • Emoji-last ordering — the panel now shows word candidates in riti's original ranking, with emoji-only candidates appended at the end. A new isEmojiCandidate(_:) helper detects emoji-only candidates (pure emoji/symbol content); anything containing Bengali or Latin letters/digits is treated as a word candidate.
  • Emoji never auto-selected — a new avoidEmojiDefault() step moves the default selection to the first word candidate whenever riti's remembered/top selection lands on an emoji. Emoji are only committed by explicit user action (arrow keys, Tab, number key, or click).
  • Display ↔ engine index mapping — since the panel order differs from the engine order, selectedIndex is now a display index and is converted at every riti boundary (riti_get_suggestion_for_key previously-selected index, marked/pre-edit text, commits, remembered selection, phonetic-first default). Navigation, digit keys, mouse clicks, and commits all follow the new order consistently.

Behavior

Before After
Emoji at top, auto-selected, committed on space Emoji at bottom, unselected; space commits the top word
Word suggestions pushed below emoji Words keep riti's ranking

Testing

  • swiftc -typecheck passes with zero errors
  • ✅ Built with make build, installed to ~/Library/Input Methods, verified live: typing boish shows বিশ et al. selected by default with 🎉 unselected at the bottom; space commits the word; emoji only via explicit selection

- Reorder candidate panel: word candidates keep riti's ranking, emoji
  candidates are appended at the end of the list.
- Emoji are never auto-selected: if riti's remembered/top selection lands
  on an emoji, selection moves to the first word candidate. Emoji are
  only committed by explicit user action (arrow keys, Tab, number key,
  or click).
- Map display <-> engine indices everywhere riti is called (key handling,
  marked text, commit, remembered selection) so navigation and commits
  stay consistent with the new order.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant