优化: 资源消耗优化,发布 v0.2.1

This commit is contained in:
2026-06-03 12:11:06 +08:00
parent 36aeef4bb7
commit 2c438e3bb9
9 changed files with 113 additions and 50 deletions

View File

@@ -189,10 +189,9 @@ func (m *Model) sessColumnLines(w, listH int) []string {
func (m *Model) detailColumnLines(w, listH int) []string {
s := m.currentSession()
if s == nil {
return []string{lipgloss.NewStyle().Foreground(style.Dim).Render(fitWidth(" ← select to view", w))}
return []string{style.DimFg.Render(fitWidth(" ← select to view", w))}
}
sepSty := lipgloss.NewStyle().Foreground(style.BgPanel)
var lines []string
favPrefix := " "
@@ -200,7 +199,7 @@ func (m *Model) detailColumnLines(w, listH int) []string {
favPrefix = "★ "
}
lines = append(lines, style.DetailTitle.Render(fitWidth(favPrefix+s.DisplayTitle(), w)))
lines = append(lines, sepSty.Render(fitWidth(strings.Repeat("─", w), w)))
lines = append(lines, style.SepFg.Render(fitWidth(sepRunes(w), w)))
fav := "-"
if m.history.Favorites[s.ID] {
@@ -218,34 +217,34 @@ func (m *Model) detailColumnLines(w, listH int) []string {
}
if summary := s.DisplaySummary(); summary != "" {
lines = append(lines, sepSty.Render(fitWidth(strings.Repeat("─", w), w)))
lines = append(lines, style.SepFg.Render(fitWidth(sepRunes(w), w)))
lines = append(lines, style.SessionSummaryStyle.Render(fitWidth(" "+summary, w)))
}
if len(s.Completed) > 0 {
lines = append(lines, sepSty.Render(fitWidth(strings.Repeat("─", w), w)))
lines = append(lines, lipgloss.NewStyle().Foreground(style.Success).Bold(true).Render(fitWidth(" ✓ 已完成", w)))
lines = append(lines, style.SepFg.Render(fitWidth(sepRunes(w), w)))
lines = append(lines, style.SuccessBoldFg.Render(fitWidth(" ✓ 已完成", w)))
for _, item := range s.Completed {
lines = append(lines, style.NormStyle.Render(fitWidth(" · "+cleanText(item), w)))
}
}
if len(s.Pending) > 0 {
lines = append(lines, sepSty.Render(fitWidth(strings.Repeat("─", w), w)))
lines = append(lines, lipgloss.NewStyle().Foreground(style.Warning).Bold(true).Render(fitWidth(" ○ 待办", w)))
lines = append(lines, style.SepFg.Render(fitWidth(sepRunes(w), w)))
lines = append(lines, style.WarningBoldFg.Render(fitWidth(" ○ 待办", w)))
for _, item := range s.Pending {
lines = append(lines, style.NormStyle.Render(fitWidth(" · "+cleanText(item), w)))
}
}
lines = append(lines, lipgloss.NewStyle().Foreground(style.Dim).Render(fitWidth(" [Enter]resume", w)))
lines = append(lines, style.DimFg.Render(fitWidth(" [Enter]resume", w)))
if s.ForkFrom != "" {
forkID := s.ForkFrom
if len(forkID) > 8 {
forkID = forkID[:8]
}
lines = append(lines, lipgloss.NewStyle().Foreground(style.Cyan).Render(fitWidth(fmt.Sprintf(" ⎇ fork from %s", forkID), w)))
lines = append(lines, style.CyanFg.Render(fitWidth(fmt.Sprintf(" ⎇ fork from %s", forkID), w)))
}
if len(lines) > listH {