From 422aaac8311dfbd9640662d5f7a5755d1d6689a9 Mon Sep 17 00:00:00 2001 From: azimut Date: Tue, 9 May 2023 15:41:07 -0300 Subject: [PATCH] format: right padding to OP comment --- internal/discourse/format.go | 6 +++++- internal/fourchan/format.go | 2 +- internal/hackernews/printer.go | 2 +- internal/lobsters/format.go | 6 +++++- internal/vichan/format.go | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/internal/discourse/format.go b/internal/discourse/format.go index 3fb6c3c..7e3cc1e 100644 --- a/internal/discourse/format.go +++ b/internal/discourse/format.go @@ -22,7 +22,11 @@ func (o Op) String() (ret string) { ret += fmt.Sprintf(" self: %s\n", o.thread.url) ret += fmt.Sprintf( "\n%s\n\n", - format.FormatHtml2Text(o.message, o.thread.LineWidth, o.thread.LeftPadding), + format.FormatHtml2Text( + o.message, + o.thread.LineWidth-o.thread.LeftPadding, + o.thread.LeftPadding, + ), ) ret += fmt.Sprintf( "%s - %s \n\n\n", diff --git a/internal/fourchan/format.go b/internal/fourchan/format.go index f16f8a2..e9f0a5e 100644 --- a/internal/fourchan/format.go +++ b/internal/fourchan/format.go @@ -32,7 +32,7 @@ func (op Op) String() (ret string) { if op.comment != "" { comment, _ := text.WrapLeftPadded( format.GreenTextIt(op.comment), - int(op.thread.LineWidth), + int(op.thread.LineWidth-op.thread.LeftPadding), int(op.thread.LeftPadding), ) ret += comment + "\n" diff --git a/internal/hackernews/printer.go b/internal/hackernews/printer.go index 9f728e7..01a1ec6 100644 --- a/internal/hackernews/printer.go +++ b/internal/hackernews/printer.go @@ -29,7 +29,7 @@ func (o Op) String() (ret string) { } ret += fmt.Sprintf(" self: %s\n", o.selfUrl) if o.text != "" { - ret += fmt.Sprintf("\n%s\n", fixupComment(o.text, 3, o.thread.LineWidth)) + ret += fmt.Sprintf("\n%s\n", fixupComment(o.text, 3, o.thread.LineWidth-3)) } ret += fmt.Sprintf( "\n%s(%d) - %s - %d Comments\n", diff --git a/internal/lobsters/format.go b/internal/lobsters/format.go index 91b4393..36e2841 100644 --- a/internal/lobsters/format.go +++ b/internal/lobsters/format.go @@ -26,7 +26,11 @@ func (o Op) String() (ret string) { if o.message != "" { ret += fmt.Sprintf( "\n%s\n\n", - format.FormatText(o.message, o.thread.LineWidth, o.thread.LeftPadding), + format.FormatText( + o.message, + o.thread.LineWidth-o.thread.LeftPadding, + o.thread.LeftPadding, + ), ) } ret += fmt.Sprintf( diff --git a/internal/vichan/format.go b/internal/vichan/format.go index 8f9e2bf..9d807ab 100644 --- a/internal/vichan/format.go +++ b/internal/vichan/format.go @@ -35,7 +35,7 @@ func (op Op) String() (ret string) { if op.message != "" { ret += "\n" + format.FormatHtml2Text( op.message, - op.thread.LineWidth, + op.thread.LineWidth-op.thread.LeftPadding, op.thread.LeftPadding, ) ret += "\n\n"