Skip to content

Commit 989f18c

Browse files
authored
Merge pull request #1126 from rumpl/width
Ensure all mesages have a max width
2 parents 417b98d + 401989e commit 989f18c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

pkg/tui/components/messages/messages.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,13 @@ func (m *model) View() string {
331331
visibleLines = m.applySelectionHighlight(visibleLines, startLine)
332332
}
333333

334+
// Ensure each line doesn't exceed the width to prevent layout overflow
335+
for i, line := range visibleLines {
336+
if ansi.StringWidth(line) > m.width {
337+
visibleLines[i] = ansi.Truncate(line, m.width, "")
338+
}
339+
}
340+
334341
return strings.Join(visibleLines, "\n")
335342
}
336343

0 commit comments

Comments
 (0)