fix(tui): center rows per-line, fix footers per-context
This commit is contained in:
@@ -190,7 +190,7 @@ func (t *SnippetListTab) View() string {
|
||||
}
|
||||
}
|
||||
|
||||
footerPlain := "Ctrl+Tab:switch Ctrl+Q:close ↑↓:nav Enter:SSH Ctrl+N:add Ctrl+F:SFTP Ctrl+K:keys Ctrl+P:snippets q:quit"
|
||||
footerPlain := "Ctrl+Tab:switch Ctrl+Q:close ↑↓:nav Ctrl+N:add Ctrl+E:edit D:delete Esc:back"
|
||||
footer := styledRow{text: SubtitleStyle.Render(footerPlain), plain: footerPlain}
|
||||
|
||||
widestRow := lipgloss.Width(titlePlain)
|
||||
@@ -205,7 +205,6 @@ func (t *SnippetListTab) View() string {
|
||||
|
||||
const sidePad = 6
|
||||
targetW := widestRow + sidePad*2
|
||||
rowShift := (targetW - widestRow) / 2
|
||||
|
||||
var inner strings.Builder
|
||||
|
||||
@@ -213,9 +212,9 @@ func (t *SnippetListTab) View() string {
|
||||
inner.WriteString(lipgloss.PlaceHorizontal(targetW, lipgloss.Center, titleStyled))
|
||||
inner.WriteString("\n\n")
|
||||
|
||||
shift := strings.Repeat(" ", rowShift)
|
||||
for _, r := range rows {
|
||||
line := lipgloss.PlaceHorizontal(targetW, lipgloss.Left, shift+r.text)
|
||||
// Render rows, excluding the footer (last element)
|
||||
for _, r := range rows[:len(rows)-1] {
|
||||
line := lipgloss.PlaceHorizontal(targetW, lipgloss.Center, r.text)
|
||||
inner.WriteString(line)
|
||||
inner.WriteString("\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user