Eliminate unnecessary scrolling for short text
What changed, and why it matters
This commit is a minor user-interface polish change. It stops text from twitching left and right when only a tiny amount of scrolling would be needed. There is no security relevance visible in the code or commit message.
No security action needed. Treat as normal UI/UX improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change adds a small threshold (min_scrollable_diff = 2 pixels) in the TextArea horizontal scrolling thread. If the text overhang is smaller than that threshold, the thread renders the text once and exits instead of entering the scrolling loop. It also extracts the render/paste/show logic into a local helper function _render_text() to avoid duplication. No input handling, cryptography, memory management, or trust boundary changes are present.
Changed components
src/seedsigner/gui/components.py - TextArea horizontal scrolling animationInspect captured patch +18 / −3
diff --git a/src/seedsigner/gui/components.py b/src/seedsigner/gui/components.py
index ac0805c..dffbf82 100644
--- a/src/seedsigner/gui/components.py
+++ b/src/seedsigner/gui/components.py
@@ -643,8 +643,24 @@ class TextArea(BaseComponent):
50px/sec creates a slight ghosting / doubling effect that impedes
readability. 45px/sec is better but still perceptually a bit stuttery.
"""
+ def _render_text():
+ img = self.rendered_text_img.crop((self.horizontal_scroll_position, 0, self.horizontal_scroll_position + self.visible_width, self.rendered_text_img.height))
+ self.renderer.canvas.paste(img, (self.screen_x, self.screen_y - self.scroll_y))
+ self.renderer.show_image()
+
max_scroll = self.rendered_text_img.width - self.visible_width
+ # Technically, the math might say that we need to scroll for 1px, but it's
+ # not worth having the text twitch back and forth by such a small amount.
+ min_scrollable_diff = 2
+
+ if max_scroll < min_scrollable_diff:
+ # No scrolling needed. Render once and exit the thread.
+ with self.renderer.lock:
+ _render_text()
+ self.stop()
+ return
+
# The scrolling holds / pauses at the start and end of the text line. These
# vars track when we started holding and how long we should hold.
hold_started_at = None
@@ -667,9 +683,8 @@ class TextArea(BaseComponent):
# We were stopped while waiting for the lock
continue
- img = self.rendered_text_img.crop((self.horizontal_scroll_position, 0, self.horizontal_scroll_position + self.visible_width, self.rendered_text_img.height))
- self.renderer.canvas.paste(img, (self.screen_x, self.screen_y - self.scroll_y))
- self.renderer.show_image()
+ # Render the latest scroll update
+ _render_text()
if hold_started_at is not None:
# If we're here, we've held long enough; reset the vars and resume
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.