mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-30 03:18:20 +00:00
rework ConfirmOutput layout (fixes #289)
This commit is contained in:
parent
59e204fe2b
commit
f70772fb58
@ -14,7 +14,7 @@ if len(sys.argv) != 2 or sys.argv[1] not in ("count", "array"):
|
|||||||
def get_fields(coin):
|
def get_fields(coin):
|
||||||
return [
|
return [
|
||||||
'"%s"' % coin['coin_name'] if coin['coin_name'] is not None else 'NULL',
|
'"%s"' % coin['coin_name'] if coin['coin_name'] is not None else 'NULL',
|
||||||
'" %s"' % coin['coin_shortcut'] if coin['coin_shortcut'] is not None else 'NULL',
|
'" %s to"' % coin['coin_shortcut'] if coin['coin_shortcut'] is not None else 'NULL',
|
||||||
'%d' % coin['maxfee_kb'] if coin['maxfee_kb'] is not None else '0',
|
'%d' % coin['maxfee_kb'] if coin['maxfee_kb'] is not None else '0',
|
||||||
'"\\x%02x" "%s"' % (len(coin['signed_message_header']), coin['signed_message_header'].replace('\n', '\\n')) if coin['signed_message_header'] is not None else 'NULL',
|
'"\\x%02x" "%s"' % (len(coin['signed_message_header']), coin['signed_message_header'].replace('\n', '\\n')) if coin['signed_message_header'] is not None else 'NULL',
|
||||||
'true' if coin['address_type'] is not None else 'false',
|
'true' if coin['address_type'] is not None else 'false',
|
||||||
|
@ -132,13 +132,13 @@ void layoutConfirmOutput(const CoinInfo *coin, const TxOutputType *out)
|
|||||||
const char *addr = out->address;
|
const char *addr = out->address;
|
||||||
int addrlen = strlen(addr);
|
int addrlen = strlen(addr);
|
||||||
int numlines = addrlen <= 34 ? 2 : 3;
|
int numlines = addrlen <= 34 ? 2 : 3;
|
||||||
strcpy(lines[0], _("to "));
|
int linelen = (addrlen + 3) / numlines + 1;
|
||||||
int linelen = (addrlen + (numlines == 3 ? 3 : 0) - 1) / numlines + 1;
|
if (linelen > 27) {
|
||||||
if (linelen > 27)
|
|
||||||
linelen = 27;
|
linelen = 27;
|
||||||
|
}
|
||||||
if (numlines == 3) {
|
if (numlines == 3) {
|
||||||
strlcpy(lines[0] + 3, addr, linelen - 3 + 1);
|
strlcpy(lines[0], addr, linelen + 1);
|
||||||
addr += linelen - 3;
|
addr += linelen;
|
||||||
}
|
}
|
||||||
strlcpy(lines[1], addr, linelen + 1);
|
strlcpy(lines[1], addr, linelen + 1);
|
||||||
addr += linelen;
|
addr += linelen;
|
||||||
|
Loading…
Reference in New Issue
Block a user