From b52263c487f28a9730329b0f77d65edf6ee8513f Mon Sep 17 00:00:00 2001 From: makeworld Date: Fri, 3 Dec 2021 20:52:30 -0500 Subject: [PATCH] Get recent theme changes to work when color = false --- config/config.go | 1 + renderer/renderer.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index bd436bc..223fb21 100644 --- a/config/config.go +++ b/config/config.go @@ -381,6 +381,7 @@ func Init() error { themeMu.Lock() theme["bg"] = tcell.ColorBlack cview.Styles.PrimitiveBackgroundColor = tcell.ColorBlack + themeMu.Unlock() } hasDarkTerminalBackground = termenv.HasDarkBackground() diff --git a/renderer/renderer.go b/renderer/renderer.go index 74b5e14..f994584 100644 --- a/renderer/renderer.go +++ b/renderer/renderer.go @@ -162,7 +162,7 @@ func convertRegularGemini(s string, numLinks, width int, proxied bool) (string, // Underline non-gemini links if enabled var linkTag string if viper.GetBool("a-general.underline") { - linkTag = "::u" + linkTag = `[` + config.GetColorString("foreign_link") + linkTag + `::u]` } // Wrap and add link text @@ -215,27 +215,27 @@ func convertRegularGemini(s string, numLinks, width int, proxied bool) (string, wrappedLink = wrapLine(linkText, width, strings.Repeat(" ", indent)+ - `["`+strconv.Itoa(num-1)+`"][`+config.GetColorString("foreign_link")+linkTag+`]`, + `["`+strconv.Itoa(num-1)+`"]`+linkTag, `[-::-][""]`, false, // Don't indent the first line, it's the one with link number ) wrappedLink[0] = fmt.Sprintf(`[%s::b][`, config.GetColorString("link_number")) + - strconv.Itoa(num) + "[]" + "[-::-]" + spacing + - `["` + strconv.Itoa(num-1) + `"][` + config.GetColorString("foreign_link") + linkTag + `]` + + strconv.Itoa(num) + "[][-::-]" + spacing + + `["` + strconv.Itoa(num-1) + `"]` + linkTag + wrappedLink[0] + `[-::-][""]` } else { // No color wrappedLink = wrapLine(linkText, width, - strings.Repeat(" ", len(strconv.Itoa(num))+4)+ // +4 for spaces and brackets - `["`+strconv.Itoa(num-1)+`"][`+linkTag+`]`, + strings.Repeat(" ", indent)+ + `["`+strconv.Itoa(num-1)+`"]`+linkTag, `[::-][""]`, false, // Don't indent the first line, it's the one with link number ) - wrappedLink[0] = `[::b][` + strconv.Itoa(num) + "[][::-] " + - `["` + strconv.Itoa(num-1) + `"][` + linkTag + `]` + + wrappedLink[0] = `[::b][` + strconv.Itoa(num) + "[][::-]" + spacing + + `["` + strconv.Itoa(num-1) + `"]` + linkTag + wrappedLink[0] + `[::-][""]` } }