From 2ea8a73eb586c048cfa337ed90c2055ea694dd0d Mon Sep 17 00:00:00 2001 From: Matt Low Date: Mon, 21 Oct 2024 15:50:07 +0000 Subject: [PATCH] Final(?) chat view footer fix --- pkg/tui/views/chat/view.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/tui/views/chat/view.go b/pkg/tui/views/chat/view.go index 0ff11d9..01b173b 100644 --- a/pkg/tui/views/chat/view.go +++ b/pkg/tui/views/chat/view.go @@ -341,19 +341,20 @@ func (m *Model) layoutFooter( return footerStyle.Render(left + padding + right) } - // Insert between left and right segments when they're being truncated - truncSeparator := "..." + // Inserted between left and right segments when they're being truncated + div := "..." - totalAvailableWidth := width - frameWidth - len(truncSeparator) + totalAvailableWidth := width - frameWidth + availableTruncWidth := totalAvailableWidth - len(div) minVisibleLength := 3 - if totalAvailableWidth < 2*minVisibleLength { - minVisibleLength = totalAvailableWidth / 2 + if availableTruncWidth < 2*minVisibleLength { + minVisibleLength = availableTruncWidth / 2 } leftProportion := float64(leftWidth) / float64(leftWidth+rightWidth) - newLeftWidth := int(max(float64(minVisibleLength), leftProportion*float64(totalAvailableWidth))) + newLeftWidth := int(max(float64(minVisibleLength), leftProportion*float64(availableTruncWidth))) newRightWidth := totalAvailableWidth - newLeftWidth truncatedLeft := faintStyle.Render(tuiutil.TruncateRightToCellWidth(left, newLeftWidth, ""))