1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-24 20:13:00 +03:00

HighlighterRegistry: add add_highlighter_to_group method

This commit is contained in:
Maxime Coste 2012-01-15 13:46:45 +00:00
parent 2cfa70a466
commit 98f937146a
2 changed files with 19 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#include "exception.hh"
#include "window.hh"
#include "highlighters.hh"
namespace Kakoune
{
@ -30,6 +31,18 @@ void HighlighterRegistry::add_highlighter_to_window(Window& window,
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,
size_t cursor_pos)
{

View File

@ -13,6 +13,7 @@ namespace Kakoune
{
class Window;
class HighlighterGroup;
typedef std::function<HighlighterAndId (Window& window,
const HighlighterParameters& params)> HighlighterFactory;
@ -27,6 +28,11 @@ public:
const std::string& factory_name,
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,
size_t cursor_pos);