summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/client/ui/core/chat/chat.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go
index ab19069..d17b500 100644
--- a/internal/client/ui/core/chat/chat.go
+++ b/internal/client/ui/core/chat/chat.go
@@ -375,7 +375,25 @@ func (m *Model) renderMessages(height int) string {
builder.WriteString(renderedGroups[i])
}
- return builder.String()
+ result := builder.String()
+
+ // Truncate any excess and show only the bottom
+ newlines := 0
+ index := -1
+ for i := len(result) - 1; i >= 0; i-- {
+ if result[i] == '\n' {
+ newlines++
+ }
+ if newlines == height {
+ index = i
+ break
+ }
+ }
+ if index != -1 {
+ return result[index+1:]
+ }
+
+ return result
}
func (m *Model) renderMessageGroup(group []data.Message, remaining *int, height int) string {