fix wrapping

master
Felix Pankratz 1 year ago
parent 7d0ce178eb
commit 23fb38b807

@ -58,11 +58,10 @@ def main(stdscr):
# calculate length of line # calculate length of line
text = f'{prefix} ()\n' text = f'{prefix} ()\n'
chars_available = width - len(text) chars_available = width - len(text)
max_title_len = (chars_available//3)*2 max_title_len = min((chars_available//3)*2, len(story.title))
max_url_len = chars_available//3 max_url_len = chars_available - max_title_len
text = f'{prefix}{(story.title[:max_title_len-1] + "") if len(story.title) > max_title_len else story.title} ({story.link[:max_url_len-1] + "" if len(story.link) > max_url_len else story.link})\n' text = f'{prefix}{(story.title[:max_title_len-1] + "") if len(story.title) > max_title_len else story.title} ({story.link[:max_url_len-1] + "" if len(story.link) > max_url_len else story.link})\n'
stdscr.addstr(text) stdscr.addstr(text)
if i == current_pos: if i == current_pos:
detail = f' by {story.author} | {story.comments} comments | {story.votes} points\n' detail = f' by {story.author} | {story.comments} comments | {story.votes} points\n'

Loading…
Cancel
Save