caret

[ACTIVE] a command line tool for browsing Lobsters in your terminal
git clone git://git.figbert.com/caret.git
Log | Files | Refs | README | LICENSE

commit 36e95968528dedda36ce827aabea45a7603c36e6
parent 661f854c9e33e607e8579e85c20370be41975142
Author: FIGBERT <figbert@figbert.com>
Date:   Thu,  4 Jan 2024 22:57:08 -0800

Fix comment indentation inconsistency

For some reason, glamour/ansi.StyleBlock.Margin is not applied to the
first line of a block of text. This commit replaces the use of this
margin at the Glamour level with an equivalent use of Lip Gloss at the
level of comment rendering.

The main way this change is noticeable is that where previously the
first lines of blockquotes were indented by an extra two spaces, they
are now aligned with other paragraphs.

Diffstat:
Mcomments/comments.go | 3++-
Mui/glamour.go | 1-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/comments/comments.go b/comments/comments.go @@ -32,6 +32,7 @@ func Load(post api.Post) tea.Cmd { return utils.Error{} } cmnt = strings.TrimSpace(cmnt) + cmnt = gloss.NewStyle().MarginLeft(2).Render(cmnt) headline := fmt.Sprintf( " %s %s", @@ -41,7 +42,7 @@ func Load(post api.Post) tea.Cmd { )), ) - composite := fmt.Sprintf("%s\n %s", headline, cmnt) + composite := fmt.Sprintf("%s\n%s", headline, cmnt) margin := gloss.NewStyle().MarginLeft(2 * comment.Depth) page.WriteString("\n\n" + margin.Render(composite)) } diff --git a/ui/glamour.go b/ui/glamour.go @@ -15,7 +15,6 @@ var GlamourConfig = ansi.StyleConfig{ BlockPrefix: "\n", BlockSuffix: "\n", }, - Margin: uintPtr(2), }, BlockQuote: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{Color: stringPtr("244")},