diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-04-28 00:35:52 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-04-28 00:35:52 +0100 |
| commit | 229768841bc63705897a27f923cb699fafc85ade (patch) | |
| tree | a53e22e6acc4ef1f0690c6d842d3758b702fdfd6 /src | |
| parent | f6e58e7271bdebb2c289405f8fba91090d5345da (diff) | |
Fix parsing of faces with a base but no attributes
Diffstat (limited to 'src')
| -rw-r--r-- | src/face_registry.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/face_registry.cc b/src/face_registry.cc index 9fe318a2..08b9c8a6 100644 --- a/src/face_registry.cc +++ b/src/face_registry.cc @@ -23,12 +23,14 @@ static FaceRegistry::FaceSpec parse_face(StringView facedesc) and (attr_it + 1) == facedesc.end()) throw runtime_error(invalid_face_error.str()); + auto colors_end = std::min(attr_it, base_it); + FaceRegistry::FaceSpec spec; auto& face = spec.face; - face.fg = attr_it != facedesc.begin() ? - str_to_color({facedesc.begin(), std::min(attr_it, bg_it)}) : Color::Default; + face.fg = colors_end != facedesc.begin() ? + str_to_color({facedesc.begin(), std::min(bg_it, colors_end)}) : Color::Default; if (bg_it != facedesc.end()) - face.bg = bg_it+1 != attr_it ? str_to_color({bg_it+1, attr_it}) : Color::Default; + face.bg = bg_it+1 != attr_it ? str_to_color({bg_it+1, colors_end}) : Color::Default; if (attr_it != facedesc.end()) { for (++attr_it; attr_it != base_it; ++attr_it) |
