diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/options.go | 7 | ||||
| -rw-r--r-- | src/options_test.go | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/options.go b/src/options.go index 1e4c8904..030368fa 100644 --- a/src/options.go +++ b/src/options.go @@ -1184,7 +1184,12 @@ func parseTheme(defaultTheme *tui.ColorTheme, str string) (*tui.ColorTheme, erro var err error theme := dupeTheme(defaultTheme) rrggbb := regexp.MustCompile("^#[0-9a-fA-F]{6}$") - for _, str := range strings.Split(strings.ToLower(str), ",") { + comma := regexp.MustCompile(`[\s,]+`) + for _, str := range comma.Split(strings.ToLower(str), -1) { + str = strings.TrimSpace(str) + if len(str) == 0 { + continue + } switch str { case "dark": theme = dupeTheme(tui.Dark256) diff --git a/src/options_test.go b/src/options_test.go index 5c9a789a..2105322e 100644 --- a/src/options_test.go +++ b/src/options_test.go @@ -333,7 +333,7 @@ func TestColorSpec(t *testing.T) { t.Errorf("colors should now be equivalent: %v, %v", tui.Dark256, customized) } - customized, _ = parseTheme(theme, "fg:231,dark,bg:232") + customized, _ = parseTheme(theme, "fg:231,dark bg:232") if customized.Fg != tui.Dark256.Fg || customized.Bg == tui.Dark256.Bg { t.Errorf("color not customized") } |
