Skip to content

Commit dcec0d3

Browse files
authored
Merge pull request #13 from oroderico/fix-extended-key-dispatch
Stop Descriptor and the back arrow doing each other's job
2 parents c536f3e + 3aecffe commit dcec0d3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎main/seedtool_app.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,14 @@ static void show_extended_keys(const char* mnemonic, const char* passphrase, con
21082108
}
21092109
items[count++] = "Descriptor";
21102110
const int selected = choose_menu_at("Extended public key", items, count, &cursor);
2111-
if (selected < 0 || (size_t)selected == count - 1) {
2111+
/* `count`, not `count - 1`: choose_menu_at returns the arrow as the
2112+
* index one past the last row - the slot the Back row used to occupy -
2113+
* so `count - 1` is the last real item instead. Here that item is
2114+
* "Descriptor", which made the two swap: picking Descriptor left the
2115+
* menu, and taking the arrow fell through to the else below and opened
2116+
* the descriptor. The other menus compare against a literal that
2117+
* already equals count, which is why this was the only one left. */
2118+
if (selected < 0 || (size_t)selected == count) {
21122119
return;
21132120
}
21142121
if (selected == 0) {

0 commit comments

Comments
 (0)