adamdottv 9 месяцев назад
Родитель
Сommit
8497145db2
1 измененных файлов с 14 добавлено и 15 удалено
  1. 14 15
      internal/tui/components/core/status.go

+ 14 - 15
internal/tui/components/core/status.go

@@ -132,11 +132,20 @@ func (m statusCmp) View() string {
 		Background(t.BackgroundDarker()).
 		Render(m.projectDiagnostics())
 
+	model := m.model()
+
+	statusWidth := max(
+		0,
+		m.width-
+			lipgloss.Width(status)-
+			lipgloss.Width(model)-
+			lipgloss.Width(diagnostics),
+	)
+
 	if m.info.Msg != "" {
 		infoStyle := styles.Padded().
 			Foreground(t.Background()).
-			Width(m.availableFooterMsgWidth(diagnostics))
-
+			Width(statusWidth)
 		switch m.info.Type {
 		case util.InfoTypeInfo:
 			infoStyle = infoStyle.Background(t.Info())
@@ -148,7 +157,7 @@ func (m statusCmp) View() string {
 
 		// Truncate message if it's longer than available width
 		msg := m.info.Msg
-		availWidth := m.availableFooterMsgWidth(diagnostics) - 10
+		availWidth := statusWidth - 10
 		if len(msg) > availWidth && availWidth > 0 {
 			msg = msg[:availWidth] + "..."
 		}
@@ -157,12 +166,12 @@ func (m statusCmp) View() string {
 		status += styles.Padded().
 			Foreground(t.Text()).
 			Background(t.BackgroundSecondary()).
-			Width(m.availableFooterMsgWidth(diagnostics)).
+			Width(statusWidth).
 			Render("")
 	}
 
 	status += diagnostics
-	status += m.model()
+	status += model
 	return status
 }
 
@@ -245,16 +254,6 @@ func (m *statusCmp) projectDiagnostics() string {
 	return strings.Join(diagnostics, " ")
 }
 
-func (m statusCmp) availableFooterMsgWidth(diagnostics string) int {
-	tokens := ""
-	tokensWidth := 0
-	if m.session.ID != "" {
-		tokens = formatTokensAndCost(m.session.PromptTokens+m.session.CompletionTokens, m.session.Cost)
-		tokensWidth = lipgloss.Width(tokens) + 2
-	}
-	return max(0, m.width-lipgloss.Width(helpWidget)-lipgloss.Width(m.model())-lipgloss.Width(diagnostics)-tokensWidth)
-}
-
 func (m statusCmp) model() string {
 	t := theme.CurrentTheme()