1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-16 11:28:14 +00:00

ui/passphrase: align long passphrase to the right

This commit is contained in:
Jan Pochyla 2018-02-06 03:34:07 +01:00
parent deb64c3c43
commit b139e1a7ac

View File

@ -63,10 +63,13 @@ class Input(Button):
tx = ax + 24 # x-offset of the content
ty = ay + ah // 2 + 8 # y-offset of the content
maxlen = const(14) # maximum text length
# 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)
display.text(tx, ty, t, text_style, fg_color, bg_color)
if p: # pending marker
pw = display.text_width(t[-1:], text_style)