diff --git a/ui/page/components/seed_restore_page.go b/ui/page/components/seed_restore_page.go index b3997d8e5..a5229e0f8 100644 --- a/ui/page/components/seed_restore_page.go +++ b/ui/page/components/seed_restore_page.go @@ -313,37 +313,27 @@ func (pg *SeedRestore) editorSeedsEventsHandler(gtx C) { for i := 0; i < len(pg.seedEditors.editors); i++ { editor := pg.seedEditors.editors[i] text := editor.Edit.Editor.Text() - - if gtx.Source.Focused(editor.Edit.Editor) { + if editor.Edit.Changed() || editor.Edit.Selected() { seedEvent(i, text) } - for { - event, ok := editor.Edit.Editor.Update(gtx) - if !ok { - break - } - switch event.(type) { - case widget.ChangeEvent: - seedEvent(i, text) - - case widget.SubmitEvent: - if pg.openPopupIndex != -1 { - if len(pg.suggestions) > 0 { - pg.seedEditors.editors[i].Edit.Editor.SetText(pg.seedMenu[pg.selected].text) - } + if editor.Edit.Submitted() { + if pg.openPopupIndex != -1 { + if len(pg.suggestions) > 0 { + pg.seedEditors.editors[i].Edit.Editor.SetText(pg.seedMenu[pg.selected].text) + pg.seedClicked = true } + } - // Handles Enter and Return keyboard events. - if i != defaultNumberOfSeeds { - gtx.Execute(key.FocusCmd{Tag: pg.seedEditors.editors[i+1].Edit.Editor}) - pg.selected = 0 - } + // Handles Enter and Return keyboard events. + if i != defaultNumberOfSeeds { + gtx.Execute(key.FocusCmd{Tag: pg.seedEditors.editors[i+1].Edit.Editor}) + pg.selected = 0 + } - if i == defaultNumberOfSeeds { - pg.selected = 0 - pg.isLastEditor = true - } + if i == defaultNumberOfSeeds { + pg.selected = 0 + pg.isLastEditor = true } } } @@ -385,11 +375,9 @@ func (pg *SeedRestore) layoutSeedMenu(gtx C, optionsSeedMenuIndex int) { } m := op.Record(gtx.Ops) - _, caretPos := pg.seedEditors.editors[pg.seedEditors.focusIndex].Edit.Editor.CaretPos() inset.Layout(gtx, func(gtx C) D { border := widget.Border{Color: pg.Theme.Color.Gray4, CornerRadius: values.MarginPadding5, Width: values.MarginPadding2} - if !pg.seedEditorChanged() && pg.nextcurrentCaretPosition != caretPos { - pg.nextcurrentCaretPosition = -1 + if !pg.seedEditorChanged() { return border.Layout(gtx, func(gtx C) D { return pg.optionsMenuCard.Layout(gtx, func(gtx C) D { gtx.Constraints.Min.X = gtx.Constraints.Max.X