fix wrapping
This commit is contained in:
parent
7d0ce178eb
commit
23fb38b807
5
hn.py
5
hn.py
@ -58,11 +58,10 @@ def main(stdscr):
|
||||
# calculate length of line
|
||||
text = f'{prefix} ()\n'
|
||||
chars_available = width - len(text)
|
||||
max_title_len = (chars_available//3)*2
|
||||
max_url_len = chars_available//3
|
||||
max_title_len = min((chars_available//3)*2, len(story.title))
|
||||
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'
|
||||
|
||||
stdscr.addstr(text)
|
||||
if i == current_pos:
|
||||
detail = f' by {story.author} | {story.comments} comments | {story.votes} points\n'
|
||||
|
Loading…
Reference in New Issue
Block a user