HighlighterRegistry: add add_highlighter_to_group method
This commit is contained in:
parent
2cfa70a466
commit
98f937146a
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "exception.hh"
|
#include "exception.hh"
|
||||||
#include "window.hh"
|
#include "window.hh"
|
||||||
|
#include "highlighters.hh"
|
||||||
|
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
@ -30,6 +31,18 @@ void HighlighterRegistry::add_highlighter_to_window(Window& window,
|
||||||
window.add_highlighter(it->second(window, parameters));
|
window.add_highlighter(it->second(window, parameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HighlighterRegistry::add_highlighter_to_group(Window& window,
|
||||||
|
HighlighterGroup& group,
|
||||||
|
const std::string& name,
|
||||||
|
const HighlighterParameters& parameters)
|
||||||
|
{
|
||||||
|
auto it = m_factories.find(name);
|
||||||
|
if (it == m_factories.end())
|
||||||
|
throw factory_not_found(name);
|
||||||
|
|
||||||
|
group.add_highlighter(it->second(window, parameters));
|
||||||
|
}
|
||||||
|
|
||||||
CandidateList HighlighterRegistry::complete_highlighter(const std::string& prefix,
|
CandidateList HighlighterRegistry::complete_highlighter(const std::string& prefix,
|
||||||
size_t cursor_pos)
|
size_t cursor_pos)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
class Window;
|
class Window;
|
||||||
|
class HighlighterGroup;
|
||||||
|
|
||||||
typedef std::function<HighlighterAndId (Window& window,
|
typedef std::function<HighlighterAndId (Window& window,
|
||||||
const HighlighterParameters& params)> HighlighterFactory;
|
const HighlighterParameters& params)> HighlighterFactory;
|
||||||
|
@ -27,6 +28,11 @@ public:
|
||||||
const std::string& factory_name,
|
const std::string& factory_name,
|
||||||
const HighlighterParameters& parameters);
|
const HighlighterParameters& parameters);
|
||||||
|
|
||||||
|
void add_highlighter_to_group(Window& window,
|
||||||
|
HighlighterGroup& group,
|
||||||
|
const std::string& factory_name,
|
||||||
|
const HighlighterParameters& parameters);
|
||||||
|
|
||||||
CandidateList complete_highlighter(const std::string& prefix,
|
CandidateList complete_highlighter(const std::string& prefix,
|
||||||
size_t cursor_pos);
|
size_t cursor_pos);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user