Window: add get_highlighter_group method
This commit is contained in:
parent
0c1e763d66
commit
2cfa70a466
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "assert.hh"
|
#include "assert.hh"
|
||||||
#include "highlighter_registry.hh"
|
#include "highlighter_registry.hh"
|
||||||
|
#include "highlighters.hh"
|
||||||
#include "hooks_manager.hh"
|
#include "hooks_manager.hh"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -402,6 +403,21 @@ void Window::remove_highlighter(const std::string& id)
|
||||||
m_highlighters.remove(id);
|
m_highlighters.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HighlighterGroup& Window::get_highlighter_group(const std::string& id)
|
||||||
|
{
|
||||||
|
auto group_it = m_highlighters.find(id);
|
||||||
|
|
||||||
|
if (group_it == m_highlighters.end())
|
||||||
|
throw runtime_error("no such group id " + id);
|
||||||
|
|
||||||
|
HighlighterGroup* group = group_it->second.target<HighlighterGroup>();
|
||||||
|
|
||||||
|
if (not group)
|
||||||
|
throw runtime_error("not a group " + id);
|
||||||
|
|
||||||
|
return *group;
|
||||||
|
}
|
||||||
|
|
||||||
CandidateList Window::complete_highlighterid(const std::string& prefix,
|
CandidateList Window::complete_highlighterid(const std::string& prefix,
|
||||||
size_t cursor_pos)
|
size_t cursor_pos)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,6 +47,7 @@ private:
|
||||||
typedef std::vector<Selection> SelectionList;
|
typedef std::vector<Selection> SelectionList;
|
||||||
|
|
||||||
class IncrementalInserter;
|
class IncrementalInserter;
|
||||||
|
class HighlighterGroup;
|
||||||
|
|
||||||
// A Window is an editing view onto a Buffer
|
// A Window is an editing view onto a Buffer
|
||||||
//
|
//
|
||||||
|
@ -103,6 +104,7 @@ public:
|
||||||
|
|
||||||
void add_highlighter(HighlighterAndId&& highlighter);
|
void add_highlighter(HighlighterAndId&& highlighter);
|
||||||
void remove_highlighter(const std::string& id);
|
void remove_highlighter(const std::string& id);
|
||||||
|
HighlighterGroup& get_highlighter_group(const std::string& id);
|
||||||
|
|
||||||
CandidateList complete_highlighterid(const std::string& prefix,
|
CandidateList complete_highlighterid(const std::string& prefix,
|
||||||
size_t cursor_pos = std::string::npos);
|
size_t cursor_pos = std::string::npos);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user