mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-25 20:41:49 +03:00
Do not resolve faces in highlighter factories, defer to actual highlighting
This commit is contained in:
parent
d78ece490f
commit
cbfceba149
@ -165,25 +165,25 @@ using FacesSpec = std::vector<String>;
|
|||||||
|
|
||||||
struct Fill
|
struct Fill
|
||||||
{
|
{
|
||||||
Fill(Face face) : m_face(face) {}
|
Fill(String facespec) : m_facespec(facespec) {}
|
||||||
|
|
||||||
void operator()(const Context& context, HighlightFlags flags,
|
void operator()(const Context& context, HighlightFlags flags,
|
||||||
DisplayBuffer& display_buffer)
|
DisplayBuffer& display_buffer)
|
||||||
{
|
{
|
||||||
auto range = display_buffer.range();
|
auto range = display_buffer.range();
|
||||||
highlight_range(display_buffer, range.first, range.second, true,
|
highlight_range(display_buffer, range.first, range.second, true,
|
||||||
apply_face(m_face));
|
apply_face(get_face(m_facespec)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Face m_face;
|
String m_facespec;
|
||||||
};
|
};
|
||||||
|
|
||||||
HighlighterAndId fill_factory(HighlighterParameters params)
|
HighlighterAndId fill_factory(HighlighterParameters params)
|
||||||
{
|
{
|
||||||
if (params.size() != 1)
|
if (params.size() != 1)
|
||||||
throw runtime_error("wrong parameter count");
|
throw runtime_error("wrong parameter count");
|
||||||
Face face = get_face(params[0]);
|
get_face(params[0]); // validate param
|
||||||
return HighlighterAndId("fill_" + params[0], Fill(face));
|
return HighlighterAndId("fill_" + params[0], Fill(params[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -402,7 +402,8 @@ HighlighterAndId highlight_line_option_factory(HighlighterParameters params)
|
|||||||
if (params.size() != 2)
|
if (params.size() != 2)
|
||||||
throw runtime_error("wrong parameter count");
|
throw runtime_error("wrong parameter count");
|
||||||
|
|
||||||
const Face& face = get_face(params[1]);
|
String facespec = params[1];
|
||||||
|
get_face(facespec); // validate facespec
|
||||||
|
|
||||||
String option_name = params[0];
|
String option_name = params[0];
|
||||||
// verify option type now
|
// verify option type now
|
||||||
@ -413,7 +414,7 @@ HighlighterAndId highlight_line_option_factory(HighlighterParameters params)
|
|||||||
{
|
{
|
||||||
int line = context.options()[option_name].get<int>();
|
int line = context.options()[option_name].get<int>();
|
||||||
highlight_range(display_buffer, {line-1, 0}, {line, 0}, false,
|
highlight_range(display_buffer, {line-1, 0}, {line, 0}, false,
|
||||||
apply_face(face));
|
apply_face(get_face(facespec)));
|
||||||
};
|
};
|
||||||
|
|
||||||
return {"hlline_" + option_name, std::move(highlighter)};
|
return {"hlline_" + option_name, std::move(highlighter)};
|
||||||
|
Loading…
Reference in New Issue
Block a user