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