From 6658cf1369c902e3824f5aa8554be135c8bdf7e6 Mon Sep 17 00:00:00 2001 From: Aditi Patel Date: Mon, 9 Sep 2024 14:41:49 -0500 Subject: [PATCH] fix: update position constant in `JoinHorizontal` (#552) * fix: update position constant in JoinHorizontal * fix: update position constant in JoinVertical --- cmd/soft/browse/browse.go | 2 +- pkg/ssh/ui.go | 4 ++-- pkg/ui/components/code/code.go | 2 +- pkg/ui/pages/repo/log.go | 4 ++-- pkg/ui/pages/repo/logitem.go | 2 +- pkg/ui/pages/repo/refsitem.go | 2 +- pkg/ui/pages/repo/repo.go | 6 +++--- pkg/ui/pages/repo/stash.go | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/soft/browse/browse.go b/cmd/soft/browse/browse.go index c13fe10abeda6dca8810354653c7e04da1b522cf..eebf28893885e9844dccd6787f03e613c67e8ffd 100644 --- a/cmd/soft/browse/browse.go +++ b/cmd/soft/browse/browse.go @@ -230,7 +230,7 @@ func (m *model) View() string { } if m.showFooter { - view = lipgloss.JoinVertical(lipgloss.Top, view, m.footer.View()) + view = lipgloss.JoinVertical(lipgloss.Left, view, m.footer.View()) } return m.common.Zone.Scan(style.Render(view)) diff --git a/pkg/ssh/ui.go b/pkg/ssh/ui.go index 9f16f5591edc291c34612a1d640abfefdab39db2..31f6a259cc2e677ac6b90ca2667c5ffee105cde4 100644 --- a/pkg/ssh/ui.go +++ b/pkg/ssh/ui.go @@ -285,10 +285,10 @@ func (ui *UI) View() string { view = "Unknown state :/ this is a bug!" } if ui.activePage == selectionPage { - view = lipgloss.JoinVertical(lipgloss.Top, ui.header.View(), view) + view = lipgloss.JoinVertical(lipgloss.Left, ui.header.View(), view) } if ui.showFooter { - view = lipgloss.JoinVertical(lipgloss.Top, view, ui.footer.View()) + view = lipgloss.JoinVertical(lipgloss.Left, view, ui.footer.View()) } return ui.common.Zone.Scan( ui.common.Styles.App.Render(view), diff --git a/pkg/ui/components/code/code.go b/pkg/ui/components/code/code.go index 7b0e3e9e72c1570eaaa266c8efe4feedef95f988..af7697260fc7d327f1791ded0ab84f69f8c86c72 100644 --- a/pkg/ui/components/code/code.go +++ b/pkg/ui/components/code/code.go @@ -114,7 +114,7 @@ func (r *Code) Init() tea.Cmd { for i, l := range lines { lines[i] = common.TruncateString(l, sideNoteWidth) } - content = lipgloss.JoinHorizontal(lipgloss.Left, strings.Join(lines, "\n"), content) + content = lipgloss.JoinHorizontal(lipgloss.Top, strings.Join(lines, "\n"), content) } // Fix styles after hard wrapping diff --git a/pkg/ui/pages/repo/log.go b/pkg/ui/pages/repo/log.go index fd1850e1c5eaabe3c6c680992db95a7aaf432e56..8de8aa78d07c45ecc49529487d2729e089240813 100644 --- a/pkg/ui/pages/repo/log.go +++ b/pkg/ui/pages/repo/log.go @@ -276,7 +276,7 @@ func (l *Log) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case LogDiffMsg: l.currentDiff = msg l.vp.SetContent( - lipgloss.JoinVertical(lipgloss.Top, + lipgloss.JoinVertical(lipgloss.Left, l.renderCommit(l.selectedCommit), renderSummary(msg, l.common.Styles, l.common.Width), renderDiff(msg, l.common.Width), @@ -290,7 +290,7 @@ func (l *Log) Update(msg tea.Msg) (tea.Model, tea.Cmd) { l.SetSize(msg.Width, msg.Height) if l.selectedCommit != nil && l.currentDiff != nil { l.vp.SetContent( - lipgloss.JoinVertical(lipgloss.Top, + lipgloss.JoinVertical(lipgloss.Left, l.renderCommit(l.selectedCommit), renderSummary(l.currentDiff, l.common.Styles, l.common.Width), renderDiff(l.currentDiff, l.common.Width), diff --git a/pkg/ui/pages/repo/logitem.go b/pkg/ui/pages/repo/logitem.go index ec315ad76c2b77f141f18aa32b5c815c283de9cd..ecdc4f1878c46ad9bc3869b81c69978571b5e3b6 100644 --- a/pkg/ui/pages/repo/logitem.go +++ b/pkg/ui/pages/repo/logitem.go @@ -134,7 +134,7 @@ func (d LogItemDelegate) Render(w io.Writer, m list.Model, index int, listItem l d.common.Zone.Mark( i.ID(), styles.Base.Render( - lipgloss.JoinVertical(lipgloss.Top, + lipgloss.JoinVertical(lipgloss.Left, truncate.String(fmt.Sprintf("%s%s", title, hash, diff --git a/pkg/ui/pages/repo/refsitem.go b/pkg/ui/pages/repo/refsitem.go index f96866d3da3c316e96289d70b36a41831d106ede..7d109de0c277251d6798b1a6aac8cfdfed082bc3 100644 --- a/pkg/ui/pages/repo/refsitem.go +++ b/pkg/ui/pages/repo/refsitem.go @@ -195,7 +195,7 @@ func (d RefItemDelegate) Render(w io.Writer, m list.Model, index int, listItem l d.common.Zone.Mark( i.ID(), st.Base.Render( - lipgloss.JoinHorizontal(lipgloss.Left, + lipgloss.JoinHorizontal(lipgloss.Top, truncate.String(selector+ref+desc+hash, uint(m.Width()-horizontalFrameSize)), ), diff --git a/pkg/ui/pages/repo/repo.go b/pkg/ui/pages/repo/repo.go index 97e1cf83c2e921c769b6a6e6a6e70e37be7c42fe..1f3263287de85373737261ae4672bae70ffbab24 100644 --- a/pkg/ui/pages/repo/repo.go +++ b/pkg/ui/pages/repo/repo.go @@ -313,7 +313,7 @@ func (r *Repo) View() string { "repo-main", mainStyle.Render(main), ) - view := lipgloss.JoinVertical(lipgloss.Top, + view := lipgloss.JoinVertical(lipgloss.Left, r.headerView(), r.tabs.View(), main, @@ -334,7 +334,7 @@ func (r *Repo) headerView() string { header = r.common.Styles.Repo.HeaderName.Render(header) desc := strings.TrimSpace(r.selectedRepo.Description()) if desc != "" { - header = lipgloss.JoinVertical(lipgloss.Top, + header = lipgloss.JoinVertical(lipgloss.Left, header, r.common.Styles.Repo.HeaderDesc.Render(desc), ) @@ -352,7 +352,7 @@ func (r *Repo) headerView() string { urlStyle.Render(url), ) - header = lipgloss.JoinHorizontal(lipgloss.Left, header, url) + header = lipgloss.JoinHorizontal(lipgloss.Top, header, url) style := r.common.Styles.Repo.Header.Width(r.common.Width) return style.Render( diff --git a/pkg/ui/pages/repo/stash.go b/pkg/ui/pages/repo/stash.go index 37f534a29b1afbac55f6400750a2bf6e902f1eed..667026b7baebc1556a3572049b6a4fb24b40e80a 100644 --- a/pkg/ui/pages/repo/stash.go +++ b/pkg/ui/pages/repo/stash.go @@ -197,7 +197,7 @@ func (s *Stash) Update(msg tea.Msg) (tea.Model, tea.Cmd) { s.currentPatch = msg if msg.Diff != nil { title := s.common.Styles.Stash.Title.Render(s.list.SelectedItem().(StashItem).Title()) - content := lipgloss.JoinVertical(lipgloss.Top, + content := lipgloss.JoinVertical(lipgloss.Left, title, "", renderSummary(msg.Diff, s.common.Styles, s.common.Width),