ui/passphrase: align long passphrase to the right

pull/25/head
Jan Pochyla 6 years ago
parent deb64c3c43
commit b139e1a7ac

@ -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)

Loading…
Cancel
Save