1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

fix(core/rust): fix bip39 input not recognizing three-letter words that could continue

[no changelog]
This commit is contained in:
tychovrahe 2022-12-12 16:35:50 +01:00 committed by TychoVrahe
parent 983b7bb6e6
commit 12b3dc23db

View File

@ -175,7 +175,9 @@ impl Bip39Input {
/// let's confirm it, otherwise just auto-complete. /// let's confirm it, otherwise just auto-complete.
fn on_input_click(&mut self, ctx: &mut EventCtx) -> Option<MnemonicInputMsg> { fn on_input_click(&mut self, ctx: &mut EventCtx) -> Option<MnemonicInputMsg> {
if let (Some(word), Some(num)) = (self.suggested_word, self.options_num) { if let (Some(word), Some(num)) = (self.suggested_word, self.options_num) {
return if num == 1 && word.starts_with(self.textbox.content()) { return if num == 1 && word.starts_with(self.textbox.content())
|| num > 1 && word.eq(self.textbox.content())
{
// Confirm button. // Confirm button.
self.textbox.clear(ctx); self.textbox.clear(ctx);
Some(MnemonicInputMsg::Confirmed) Some(MnemonicInputMsg::Confirmed)
@ -207,7 +209,9 @@ impl Bip39Input {
// Change the style of the button depending on the completed word. // Change the style of the button depending on the completed word.
if let (Some(word), Some(num)) = (self.suggested_word, self.options_num) { if let (Some(word), Some(num)) = (self.suggested_word, self.options_num) {
if num == 1 && word.starts_with(self.textbox.content()) { if num == 1 && word.starts_with(self.textbox.content())
|| num > 1 && word.eq(self.textbox.content())
{
// Confirm button. // Confirm button.
self.button.enable(ctx); self.button.enable(ctx);
self.button.set_stylesheet(ctx, theme::button_confirm()); self.button.set_stylesheet(ctx, theme::button_confirm());