What changed, and why it matters
This commit is a cosmetic user-interface cleanup. It changes how numbered word lists are formatted on screen so the numbers line up neatly and a missing space is restored. There is no security-relevant change.
No security action needed; treat as a normal UI improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors mnemonic display formatting in two files. In src/krux/pages/__init__.py it replaces a manual spacing rule with a single right-aligned format string {:>2}. {}. In src/krux/pages/mnemonic_editor.py it consolidates repeated draw_string calls, adds the missing space after the period, and renders the second half of a 24-word mnemonic in a two-column layout. No cryptographic, input-validation, or access-control logic is modified.
Changed components
src/krux/pages/__init__.pysrc/krux/pages/mnemonic_editor.pyInspect captured patch +29 / −35
diff --git a/src/krux/pages/__init__.py b/src/krux/pages/__init__.py
index 9da6dc7..5e954c0 100644
--- a/src/krux/pages/__init__.py
+++ b/src/krux/pages/__init__.py
@@ -344,10 +344,7 @@ class Page:
display_mnemonic = display_mnemonic or mnemonic
words = display_mnemonic.split(" ")
- word_list = [
- "{}.{}{}".format(i + 1, " " if i + 1 < 10 else " ", word)
- for i, word in enumerate(words)
- ]
+ word_list = ["{:>2}. {}".format(i + 1, word) for i, word in enumerate(words)]
if is_double_mnemonic(mnemonic):
suffix += "*"
if fingerprint:
diff --git a/src/krux/pages/mnemonic_editor.py b/src/krux/pages/mnemonic_editor.py
index 828923e..e78c2e0 100644
--- a/src/krux/pages/mnemonic_editor.py
+++ b/src/krux/pages/mnemonic_editor.py
@@ -210,41 +210,38 @@ class MnemonicEditor(Page):
x_padding = MINIMAL_PADDING
while word_index < 12:
paged_index = word_index + page * 12
+ font_color = word_color(paged_index)
+ bg_color = theme.bg_color
if word_index == button_index and self.ctx.input.buttons_active:
+ # Flip the color values for the selected word
+ bg_color = font_color
+ font_color = theme.bg_color
+ self.ctx.display.draw_string(
+ x_padding,
+ y_region,
+ "{:>2}".format(paged_index + 1)
+ + ". "
+ + self.current_mnemonic[paged_index],
+ color=font_color,
+ bg_color=bg_color,
+ )
+ if self.mnemonic_length == 24 and not kboard.is_m5stickv:
+ # Display is wide enough; render the next 12 words on the right side
+ font_color = word_color(word_index + 12)
+ bg_color = theme.bg_color
+ if word_index + 12 == button_index and self.ctx.input.buttons_active:
+ # Flip the color values for the selected word
+ bg_color = font_color
+ font_color = theme.bg_color
self.ctx.display.draw_string(
- x_padding,
- y_region,
- str(paged_index + 1) + "." + self.current_mnemonic[paged_index],
- theme.bg_color,
- word_color(paged_index),
- )
- else:
- self.ctx.display.draw_string(
- x_padding,
+ MINIMAL_PADDING + self.ctx.display.width() // 2,
y_region,
- str(paged_index + 1) + "." + self.current_mnemonic[paged_index],
- word_color(paged_index),
+ "{:>2}".format(word_index + 13)
+ + ". "
+ + self.current_mnemonic[word_index + 12],
+ color=font_color,
+ bg_color=bg_color,
)
- if self.mnemonic_length == 24 and not kboard.is_m5stickv:
- if word_index + 12 == button_index and self.ctx.input.buttons_active:
- self.ctx.display.draw_string(
- MINIMAL_PADDING + self.ctx.display.width() // 2,
- y_region,
- str(word_index + 13)
- + "."
- + self.current_mnemonic[word_index + 12],
- theme.bg_color,
- word_color(word_index + 12),
- )
- else:
- self.ctx.display.draw_string(
- MINIMAL_PADDING + self.ctx.display.width() // 2,
- y_region,
- str(word_index + 13)
- + "."
- + self.current_mnemonic[word_index + 12],
- word_color(word_index + 12),
- )
word_index += 1
y_region += word_v_padding
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.