From ebd72cf16c0898eb20b4530cf33cde57bad1ca0e Mon Sep 17 00:00:00 2001 From: swanadiva Date: Tue, 23 Jun 2026 19:22:58 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20SFTP=20pane=20width=20=E2=80=94=20accoun?= =?UTF-8?q?t=20for=20border=20in=20halfW=20calculation,=20fix=20innerW=20t?= =?UTF-8?q?o=20maxW-2=20(padding=20only),=20truncate=20filter=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: lipgloss Width(maxW) = content area inside border, border adds 2 chars extra. - halfW was t.width/2, should be t.width/2-2 (reserve border per pane) - innerW was maxW-4, should be maxW-2 (padding only, not border) - Each pane total = maxW + 2 (content + border) --- pkg/tui/sftp_browser_tab.go | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/pkg/tui/sftp_browser_tab.go b/pkg/tui/sftp_browser_tab.go index 6d351e9..78fc0e9 100644 --- a/pkg/tui/sftp_browser_tab.go +++ b/pkg/tui/sftp_browser_tab.go @@ -541,14 +541,19 @@ 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 if t.width < 50 { - // Stack vertically — each pane gets full width - leftView = t.renderPane(&t.left, paneLocal, t.width) - rightView = t.renderPane(&t.right, paneRemote, t.width) + // Stack vertically — each pane gets full width minus border + paneW := t.width - 2 + if paneW < 20 { + paneW = 20 + } + leftView = t.renderPane(&t.left, paneLocal, paneW) + rightView = t.renderPane(&t.right, paneRemote, paneW) } else { - // Side by side — each pane gets half width - halfW := t.width / 2 + // Side by side — reserve 2 chars border per pane + halfW := t.width/2 - 2 if halfW < 20 { halfW = 20 } @@ -601,8 +606,9 @@ func (t *SFTPBrowserTab) renderPane(p *sftpPane, pt paneType, maxW int) string { paneStyle = StylePaneActive } - // Inner content width: border(2) + padding(2) = 4 overhead - innerW := maxW - 4 + // Inner content width: Width(maxW) sets content area inside border + // Padding(0,1) takes 2 chars → inner text = maxW - 2 + innerW := maxW - 2 if innerW < 5 { innerW = 5 } @@ -689,7 +695,11 @@ func (t *SFTPBrowserTab) renderPane(p *sftpPane, pt paneType, maxW int) string { } if p.filterMode { - content.WriteString("\n" + SubtitleStyle.Render("Filter: "+p.filter+"_")) + filterLine := "Filter: " + p.filter + "_" + if lipgloss.Width(filterLine) > innerW { + filterLine = truncateStr(filterLine, innerW) + } + content.WriteString("\n" + SubtitleStyle.Render(filterLine)) } inner := titleBar + "\n" + content.String()