From ef32867f10f4b1d6bef08d7075ff95cadfc4d71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=9D=E5=B0=98?= <237809796@qq.com> Date: Fri, 22 May 2026 16:25:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96:=20=E5=93=81=E7=89=8C?= =?UTF-8?q?=E5=8D=87=E7=BA=A7U-TABS=EF=BC=8C=E9=BB=98=E8=AE=A4=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=8E=86=E5=8F=B2=E5=AF=B9=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/app.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/internal/app.go b/internal/app.go index bbf7ef4..e2b118f 100644 --- a/internal/app.go +++ b/internal/app.go @@ -39,7 +39,7 @@ type Model struct { func NewModel() *Model { return &Model{ - activeGroup: 0, + activeGroup: len(Groups), // 默认打开历史对话 selected: make(map[int]bool), } } @@ -112,7 +112,7 @@ func (m *Model) handleKey(s string) (*Model, tea.Cmd) { if s == "1" { if m.IsHistoryTab() { m.activeGroup = 0 - m.resetCursor() + m.resetCursor() m.wsFocus = 1 } return m, nil @@ -120,7 +120,7 @@ func (m *Model) handleKey(s string) (*Model, tea.Cmd) { if s == "2" { if !m.IsHistoryTab() { m.activeGroup = len(Groups) // HISTORY - m.resetCursor() + m.resetCursor() m.wsFocus = 1 return m, m.onTabSwitch() } @@ -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"), }