Repository navigation
Commit 3aecffe
committed
Stop Descriptor and the back arrow doing each other's job
In Extended public key, choosing "Descriptor" left the menu and taking
the back arrow opened the descriptor. Both address types are affected.
choose_menu_at returns the arrow as the index one past the last row -
the slot the Back row occupied before the arrow replaced it - so a
caller checks for `count`. This one checked `count - 1`, which is the
last real item, and here that item is "Descriptor": the check caught it
and returned, while the arrow's own value fell past every branch to the
else that opens the descriptor.
It was correct when written. The menu had an explicit "Back" row then,
so `count - 1` was that row's index. Lifting Back into the arrow was
meant to be transparent for callers - the arrow returns the index the
row used to have, so "the checks against its old index still read the
same answer" - and it is, for a caller comparing against a literal,
which is what Backup, Settings and Derivation each do. This one derived
its check from `count`, and `count` itself shrank by one when the row
left the array, so the comparison slid off the arrow and onto the last
item. Silent, because the result is still a valid index.
The other eight menu call sites were read for the same shape; none
derives its exit test from `count`, and the two that compute their row
count still compare against the right value.
Nothing here would have caught it: the self-test covers rendering and
geometry, not menu dispatch, and these functions are static in
seedtool_app.c and out of the simulator's reach. Adding a check that
would is worth doing and is not attempted here.
Verified with the host self-test and the 51 Python tests. The dispatch
itself was checked by reading every menu call site, not by walking the
menu - see above for why this tree has no way to assert it.1 parent c536f3e commit 3aecffe
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2108 | 2108 | | |
2109 | 2109 | | |
2110 | 2110 | | |
2111 | | - | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
2112 | 2119 | | |
2113 | 2120 | | |
2114 | 2121 | | |
| |||
0 commit comments