fix: SFTP stacked mode — render only active pane + indicator bar
Stacked mode (<50 cols) now shows only the active pane (Local/Remote) with a visual indicator bar. Tab switches between panes. Side-by-side mode (>=50 cols) unchanged.
This commit is contained in:
@@ -543,14 +543,33 @@ func (t *SFTPBrowserTab) View() string {
|
||||
// Responsive pane layout: stack vertically on narrow terminals
|
||||
// Each pane renders at maxW+2 total (maxW content + 2 border chars)
|
||||
var leftView, rightView string
|
||||
var indicator string
|
||||
if t.width < 50 {
|
||||
// Stack vertically — each pane gets full width minus border
|
||||
// Only show active pane in stacked mode — Tab switches between them
|
||||
paneW := t.width - 2
|
||||
if paneW < 20 {
|
||||
paneW = 20
|
||||
}
|
||||
leftView = t.renderPane(&t.left, paneLocal, paneW)
|
||||
rightView = t.renderPane(&t.right, paneRemote, paneW)
|
||||
// Pane indicator: [Local] Remote or Local [Remote]
|
||||
var indicatorParts []string
|
||||
for _, name := range []string{"Local", "Remote"} {
|
||||
pt := paneLocal
|
||||
if name == "Remote" {
|
||||
pt = paneRemote
|
||||
}
|
||||
if t.active == pt {
|
||||
indicatorParts = append(indicatorParts, StatusBarStyle.Render(" "+name+" "))
|
||||
} else {
|
||||
indicatorParts = append(indicatorParts, SubtitleStyle.Render(" "+name+" "))
|
||||
}
|
||||
}
|
||||
indicator = lipgloss.JoinHorizontal(lipgloss.Top, indicatorParts[0], SubtitleStyle.Render(" "), indicatorParts[1])
|
||||
|
||||
if t.active == paneLocal {
|
||||
leftView = t.renderPane(&t.left, paneLocal, paneW)
|
||||
} else {
|
||||
leftView = t.renderPane(&t.right, paneRemote, paneW)
|
||||
}
|
||||
} else {
|
||||
// Side by side — reserve 2 chars border per pane
|
||||
halfW := t.width/2 - 2
|
||||
@@ -568,7 +587,9 @@ func (t *SFTPBrowserTab) View() string {
|
||||
b.WriteString("\n")
|
||||
|
||||
if t.width < 50 {
|
||||
b.WriteString(lipgloss.JoinVertical(lipgloss.Left, leftView, rightView))
|
||||
b.WriteString(lipgloss.PlaceHorizontal(t.width, lipgloss.Center, indicator))
|
||||
b.WriteString("\n")
|
||||
b.WriteString(leftView)
|
||||
} else {
|
||||
b.WriteString(lipgloss.JoinHorizontal(lipgloss.Top, leftView, rightView))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user