Skip to content

Commit

Permalink
Update psbt_screens.py
Browse files Browse the repository at this point in the history
Ensure that regular displays that don't have space constraints aren't unnecessarily truncated.
  • Loading branch information
kdmukai committed May 26, 2022
1 parent ad9375c commit fc98841
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/seedsigner/gui/screens/psbt_screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def __post_init__(self):
# Now let's maximize the actual destination col by adjusting our addr truncation
def calculate_destination_col_width(truncate_at: int = 0):
def truncate_destination_addr(addr):
if len(addr) <= truncate_at + len("..."):
# No point in truncating
return addr
return f"{addr[:truncate_at]}..."

destination_column = []
Expand Down Expand Up @@ -154,7 +157,7 @@ def truncate_destination_addr(addr):
(destination_text_width, destination_column) = calculate_destination_col_width()
else:
# Steadliy widen out the destination column until we run out of space
for i in range(6, 13):
for i in range(6, 14):
(new_width, new_col_text) = calculate_destination_col_width(truncate_at=i)
if new_width > max_destination_col_width:
break
Expand Down

0 comments on commit fc98841

Please sign in to comment.