From 6379e9693841df805e014766aa9f5cd7603264f7 Mon Sep 17 00:00:00 2001 From: Stavros Korokithakis Date: Wed, 1 Jul 2026 20:30:09 +0300 Subject: [PATCH] Show verbatim typed word in rightmost suggestion slot When not autocorrecting, the exact word the user typed was never shown on the suggestion strip, so it could not be tapped to commit and be learned into the dictionary. Present it in the rightmost slot (unless it duplicates the center suggestion), leaving the center commit target and the autocorrect, gesture, and prediction paths unchanged. --- .../futo/inputmethod/latin/uix/ActionBar.kt | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt b/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt index 8ae519b348..d7fa8b5509 100644 --- a/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt +++ b/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt @@ -525,16 +525,37 @@ fun RowScope.SuggestionItems(words: SuggestedWords, onClick: (i: Int) -> Unit, o } else -> { + val centerWord = layout.sortedMatches.getOrNull(0) + + // Present the verbatim typed word on the right so the user can tap it + // to commit-and-learn. Skip it when there is none, or when it would + // duplicate the center suggestion (the default commit target), in + // which case we fall back to the next dictionary suggestion below. + val verbatimWord = layout.verbatimWord + val showVerbatim = verbatimWord != null && verbatimWord.mWord != centerWord?.mWord + var supplementalSuggestionIndex = 1 if(layout.emojiMatches.isEmpty()) { - suggestionItem(layout.sortedMatches.getOrNull(supplementalSuggestionIndex++)) + var leftIndex = supplementalSuggestionIndex + // Don't show the same text twice: if the next dictionary word is + // the verbatim word already shown on the right, advance past it. + if(showVerbatim && layout.sortedMatches.getOrNull(leftIndex)?.mWord == verbatimWord?.mWord) { + leftIndex++ + } + suggestionItem(layout.sortedMatches.getOrNull(leftIndex)) + supplementalSuggestionIndex = leftIndex + 1 } else { suggestionItem(layout.emojiMatches[0]) } SuggestionSeparator() - suggestionItem(layout.sortedMatches.getOrNull(0)) + // Center slot is the default commit target and must never be altered. + suggestionItem(centerWord) SuggestionSeparator() - suggestionItem(layout.sortedMatches.getOrNull(supplementalSuggestionIndex)) + if(showVerbatim) { + suggestionItem(verbatimWord) + } else { + suggestionItem(layout.sortedMatches.getOrNull(supplementalSuggestionIndex)) + } } } }