diff options
| author | Dan Rosén <dan.rosen@gu.se> | 2017-03-10 10:06:37 +0100 |
|---|---|---|
| committer | Dan Rosén <dan.rosen@gu.se> | 2017-03-11 21:43:51 +0100 |
| commit | 5a403a961149e51f344233c901bee5da9e7cac0a (patch) | |
| tree | 4d826db8a7d2fc6648a5a00e50f58458591b61ad /src/display_buffer.cc | |
| parent | b9317ba38c3e8f2bc4196705d65bbc8a8ef8dbf4 (diff) | |
Increase modelinefmt configuration power
Diffstat (limited to 'src/display_buffer.cc')
| -rw-r--r-- | src/display_buffer.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/display_buffer.cc b/src/display_buffer.cc index d24d65f2..1fb82d19 100644 --- a/src/display_buffer.cc +++ b/src/display_buffer.cc @@ -286,7 +286,7 @@ void DisplayBuffer::optimize() line.optimize(); } -DisplayLine parse_display_line(StringView line) +DisplayLine parse_display_line(StringView line, const HashMap<String, DisplayLine>& builtins) { DisplayLine res; bool was_antislash = false; @@ -312,7 +312,18 @@ DisplayLine parse_display_line(StringView line) auto closing = std::find(it+1, end, '}'); if (closing == end) throw runtime_error("unclosed face definition"); - face = get_face({it+1, closing}); + if (*(it+1) == '{' and closing+1 != end and *(closing+1) == '}') + { + auto builtin_it = builtins.find(StringView{it+2, closing}); + if (builtin_it == builtins.end()) + throw runtime_error(format("undefined atom {}", StringView{it+2, closing})); + for (auto& atom : builtin_it->value) + res.push_back(atom); + // closing is now at the first char of "}}", advance it to the second + ++closing; + } + else + face = get_face({it+1, closing}); it = closing; pos = closing + 1; } |
