fix(tui): center all tabs, full-screen SFTP, muted inline keybindings

This commit is contained in:
swanadiva
2026-06-23 17:12:12 +07:00
parent c7568e0bf4
commit 7f197b9e3a
8 changed files with 355 additions and 232 deletions
+8 -19
View File
@@ -4,7 +4,6 @@ import (
"strings"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)
// Tab represents a single tab in the TUI
@@ -45,6 +44,13 @@ func (tm *TabManager) Active() Tab {
func (tm *TabManager) Add(tab Tab) tea.Cmd {
tm.tabs = append(tm.tabs, tab)
tm.active = len(tm.tabs) - 1
// Forward current terminal size so new tabs know their dimensions
if tm.width > 0 && tm.height > 0 {
updated, _ := tab.Update(tea.WindowSizeMsg{Width: tm.width, Height: tm.height})
tm.tabs[tm.active] = updated
}
return tab.Init()
}
@@ -168,10 +174,6 @@ func (tm *TabManager) View() string {
b.WriteString(content)
}
// Render status bar
b.WriteString("\n")
b.WriteString(renderStatusBar(tm))
return b.String()
}
@@ -195,17 +197,4 @@ func renderTabBar(tm *TabManager) string {
return TabBarStyle.Render(bar)
}
// renderStatusBar renders the bottom status bar, centered
func renderStatusBar(tm *TabManager) string {
hints := "Ctrl+Tab:switch Ctrl+Q:close ↑↓:nav Enter:SSH Ctrl+N:add Ctrl+F:SFTP Ctrl+K:keys Ctrl+P:snippets q:quit"
rendered := StatusBarStyle.Render(hints)
// Center within the terminal width
if tm.width > 0 {
w := lipgloss.Width(rendered)
if w < tm.width {
pad := (tm.width - w) / 2
rendered = strings.Repeat(" ", pad) + rendered
}
}
return rendered
}