From 14b58ba015b8dccc5d385717d6b04bd28f706b4a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 23 Mar 2023 10:39:24 +0530 Subject: [PATCH] Fix overrides not being parsed correctly --- tools/cmd/diff/highlight.go | 6 ++++-- tools/cmd/ssh/main.go | 2 +- tools/config/api.go | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/cmd/diff/highlight.go b/tools/cmd/diff/highlight.go index 1c3c41784..4bd97e143 100644 --- a/tools/cmd/diff/highlight.go +++ b/tools/cmd/diff/highlight.go @@ -144,10 +144,12 @@ func highlight_file(path string) (highlighted string, err error) { lexer = chroma.Coalesce(lexer) name := conf.Pygments_style const DEFAULT_LIGHT_THEME = "borland" + var style *chroma.Style if name == "default" { - DefaultStyle() + style = DefaultStyle() + } else { + style = styles.Get(name) } - style := styles.Get(name) if style == nil { if conf.Background.IsDark() && !conf.Foreground.IsDark() { style = styles.Get("monokai") diff --git a/tools/cmd/ssh/main.go b/tools/cmd/ssh/main.go index 8b3a9f100..891c51bd0 100644 --- a/tools/cmd/ssh/main.go +++ b/tools/cmd/ssh/main.go @@ -106,7 +106,7 @@ func parse_kitten_args(found_extra_args []string, username, hostname_for_match s literal_env = le } } else if key != "hostname" { - overrides = append(overrides, key+" "+val) + overrides = append(overrides, key+"="+val) } } } diff --git a/tools/config/api.go b/tools/config/api.go index f8f9c29d5..709f9496d 100644 --- a/tools/config/api.go +++ b/tools/config/api.go @@ -219,7 +219,9 @@ func (self *LinesScanner) Err() error { } func (self *ConfigParser) ParseOverrides(overrides ...string) error { - s := LinesScanner{lines: overrides} + s := LinesScanner{lines: utils.Map(func(x string) string { + return strings.Replace(x, "=", " ", 1) + }, overrides)} self.seen_includes = make(map[string]bool) return self.parse(&s, "", utils.ConfigDir(), 0) }