mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-15 20:19:23 +00:00
ui/passphrase: align long passphrase to the right
This commit is contained in:
parent
deb64c3c43
commit
b139e1a7ac
@ -63,10 +63,13 @@ class Input(Button):
|
|||||||
|
|
||||||
tx = ax + 24 # x-offset of the content
|
tx = ax + 24 # x-offset of the content
|
||||||
ty = ay + ah // 2 + 8 # y-offset of the content
|
ty = ay + ah // 2 + 8 # y-offset of the content
|
||||||
|
maxlen = const(14) # maximum text length
|
||||||
|
|
||||||
# input content
|
# input content
|
||||||
display.text(tx, ty, t, text_style, fg_color, bg_color)
|
if len(t) > maxlen:
|
||||||
|
t = '<' + t[-maxlen:] # too long, align to the right
|
||||||
width = display.text_width(t, text_style)
|
width = display.text_width(t, text_style)
|
||||||
|
display.text(tx, ty, t, text_style, fg_color, bg_color)
|
||||||
|
|
||||||
if p: # pending marker
|
if p: # pending marker
|
||||||
pw = display.text_width(t[-1:], text_style)
|
pw = display.text_width(t[-1:], text_style)
|
||||||
|
Loading…
Reference in New Issue
Block a user