parent
daeefe2f33
commit
6d651c59d0
|
@ -8,6 +8,11 @@
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
|
struct group_not_found : public runtime_error
|
||||||
|
{
|
||||||
|
using runtime_error::runtime_error;
|
||||||
|
};
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
class FunctionGroup
|
class FunctionGroup
|
||||||
{
|
{
|
||||||
|
@ -39,10 +44,10 @@ public:
|
||||||
String id(path.begin(), sep_it);
|
String id(path.begin(), sep_it);
|
||||||
auto it = m_functions.find(id);
|
auto it = m_functions.find(id);
|
||||||
if (it == m_functions.end())
|
if (it == m_functions.end())
|
||||||
throw runtime_error("no such id: " + id);
|
throw group_not_found("no such id: " + id);
|
||||||
FunctionGroup* group = it->second.template target<FunctionGroup>();
|
FunctionGroup* group = it->second.template target<FunctionGroup>();
|
||||||
if (not group)
|
if (not group)
|
||||||
throw runtime_error("not a group: " + id);
|
throw group_not_found("not a group: " + id);
|
||||||
if (sep_it != path.end())
|
if (sep_it != path.end())
|
||||||
return group->get_group(String(sep_it+1, path.end()), path_separator);
|
return group->get_group(String(sep_it+1, path.end()), path_separator);
|
||||||
else
|
else
|
||||||
|
|
|
@ -806,9 +806,13 @@ HighlighterAndId region_ref_factory(HighlighterParameters params)
|
||||||
|
|
||||||
auto func = [name](const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer,
|
auto func = [name](const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer,
|
||||||
BufferCoord begin, BufferCoord end)
|
BufferCoord begin, BufferCoord end)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
HighlighterGroup& ref = DefinedHighlighters::instance().get_group(name, '/');
|
HighlighterGroup& ref = DefinedHighlighters::instance().get_group(name, '/');
|
||||||
apply_highlighter(context, flags, display_buffer, begin, end, ref);
|
apply_highlighter(context, flags, display_buffer, begin, end, ref);
|
||||||
|
}
|
||||||
|
catch (group_not_found&) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
return HighlighterAndId("regionref(" + params[0] + "," + params[1] + "," + name + ")",
|
return HighlighterAndId("regionref(" + params[0] + "," + params[1] + "," + name + ")",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user