优化: 品牌升级U-TABS,默认打开历史对话

This commit is contained in:
2026-05-22 16:25:00 +08:00
parent e125ac6088
commit ef32867f10

View File

@@ -39,7 +39,7 @@ type Model struct {
func NewModel() *Model {
return &Model{
activeGroup: 0,
activeGroup: len(Groups), // 默认打开历史对话
selected: make(map[int]bool),
}
}
@@ -182,10 +182,6 @@ func (m *Model) handleWorkspaceKey(s string) (*Model, tea.Cmd) {
} else {
return m.launchSelected()
}
case " ":
if m.wsFocus == 1 {
m.toggleMultiSelect()
}
default:
if len(s) == 1 && s[0] >= '0' && s[0] <= '9' {
m.inputBuf += s
@@ -487,14 +483,14 @@ func (m *Model) View() tea.View {
v := tea.NewView(m.render())
v.AltScreen = true
v.MouseMode = tea.MouseModeCellMotion
v.WindowTitle = "u-tabs"
v.WindowTitle = "U-TABS"
return v
}
// renderTabBar 顶部两个主 tab工作空间 / 历史对话
func (m *Model) renderTabBar() string {
var b strings.Builder
b.WriteString(style.TitleStyle.Render(" u-tabs v" + Version + " "))
b.WriteString(style.TitleStyle.Render(" U-TABS "))
sep := style.TabSep.Render(" │ ")
// Tab 1: 工作空间
@@ -566,7 +562,14 @@ func (m *Model) render() string {
b.WriteString("\n")
helpParts := m.renderHelp()
b.WriteString(" " + strings.Join(helpParts, " "))
helpStr := " " + strings.Join(helpParts, " ")
verStr := lipgloss.NewStyle().Foreground(style.Dim).Render("绝尘 v" + Version)
padW := m.width - lipgloss.Width(helpStr) - lipgloss.Width(verStr)
if padW > 0 {
b.WriteString(helpStr + strings.Repeat(" ", padW) + verStr)
} else {
b.WriteString(helpStr + " " + verStr)
}
if hint := ConfigHint(); hint != "" {
b.WriteString("\n" + hint)
@@ -577,7 +580,7 @@ func (m *Model) render() string {
func (m *Model) renderHelp() []string {
if m.IsHistoryTab() {
return []string{
m.fmtHelp("j/k", "sel"),
m.fmtHelp("↑↓", "sel"),
m.fmtHelp("←→", "panel"),
m.fmtHelp("Enter", "resume"),
m.fmtHelp("f", "star"),
@@ -589,9 +592,8 @@ func (m *Model) renderHelp() []string {
}
return []string{
m.fmtHelp("←→", "col"),
m.fmtHelp("j/k", "sel"),
m.fmtHelp("↑↓", "sel"),
m.fmtHelp("Enter", "run"),
m.fmtHelp("Space", "multi"),
m.fmtHelp("2", "history"),
m.fmtHelp("q", "quit"),
}