Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions prompt_toolkit/layout/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def _trim_formatted_text(
result = [] # Text fragments.
remaining_width = max_width - 3

for style_and_ch in explode_text_fragments(formatted_text):
for style_and_ch in explode_text_fragments(formatted_text)[::-1]:
ch_width = get_cwidth(style_and_ch[1])

if ch_width <= remaining_width:
Expand All @@ -235,7 +235,7 @@ def _trim_formatted_text(

result.append(('', '...'))

return result, max_width - remaining_width
return result[::-1], max_width - remaining_width
else:
return formatted_text, width

Expand Down