Remove the default_face parameter of parse_display_line

No need to define a default face there, we will pass a default face
to UserInterface::draw_status later.
This commit is contained in:
Maxime Coste 2015-09-20 11:34:13 +01:00
parent b3e0e27d1f
commit 2b4b73ae8e
4 changed files with 6 additions and 8 deletions

View File

@ -99,14 +99,12 @@ void Client::print_status(DisplayLine status_line)
DisplayLine Client::generate_mode_line() const DisplayLine Client::generate_mode_line() const
{ {
Face status_face = get_face("StatusLine");
DisplayLine modeline; DisplayLine modeline;
try try
{ {
const String& modelinefmt = context().options()["modelinefmt"].get<String>(); const String& modelinefmt = context().options()["modelinefmt"].get<String>();
modeline = parse_display_line(expand(modelinefmt, context()), status_face); modeline = parse_display_line(expand(modelinefmt, context()));
} }
catch (runtime_error& err) catch (runtime_error& err)
{ {

View File

@ -904,7 +904,7 @@ const CommandDesc echo_cmd = {
if (parser.get_switch("debug")) if (parser.get_switch("debug"))
write_to_debug_buffer(message); write_to_debug_buffer(message);
else if (parser.get_switch("markup")) else if (parser.get_switch("markup"))
context.print_status(parse_display_line(message, get_face("StatusLine"))); context.print_status(parse_display_line(message));
else else
{ {
auto face = get_face(parser.get_switch("color").value_or("StatusLine").str()); auto face = get_face(parser.get_switch("color").value_or("StatusLine").str());

View File

@ -253,13 +253,13 @@ void DisplayBuffer::optimize()
line.optimize(); line.optimize();
} }
DisplayLine parse_display_line(StringView line, Face default_face) DisplayLine parse_display_line(StringView line)
{ {
DisplayLine res; DisplayLine res;
bool was_antislash = false; bool was_antislash = false;
auto pos = line.begin(); auto pos = line.begin();
String content; String content;
Face face = default_face; Face face;
for (auto it = line.begin(), end = line.end(); it != end; ++it) for (auto it = line.begin(), end = line.end(); it != end; ++it)
{ {
const char c = *it; const char c = *it;
@ -279,7 +279,7 @@ DisplayLine parse_display_line(StringView line, Face default_face)
auto closing = std::find(it+1, end, '}'); auto closing = std::find(it+1, end, '}');
if (closing == end) if (closing == end)
throw runtime_error("unclosed face definition"); throw runtime_error("unclosed face definition");
face = merge_faces(default_face, get_face({it+1, closing})); face = get_face({it+1, closing});
it = closing; it = closing;
pos = closing + 1; pos = closing + 1;
} }

View File

@ -140,7 +140,7 @@ private:
AtomList m_atoms; AtomList m_atoms;
}; };
DisplayLine parse_display_line(StringView line, Face default_face); DisplayLine parse_display_line(StringView line);
class DisplayBuffer : public UseMemoryDomain<MemoryDomain::Display> class DisplayBuffer : public UseMemoryDomain<MemoryDomain::Display>
{ {