Filters: code cleanup
This commit is contained in:
parent
9f66354948
commit
55c092eed9
|
@ -1,6 +1,8 @@
|
|||
#include "filters.hh"
|
||||
|
||||
#include "display_buffer.hh"
|
||||
#include "filter_registry.hh"
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -149,6 +151,7 @@ void register_filters()
|
|||
{
|
||||
FilterRegistry& registry = FilterRegistry::instance();
|
||||
|
||||
registry.register_factory("expand_tabs", SimpleFilterFactory<expand_tabulations>("expand_tabs"));
|
||||
registry.register_factory("line_numbers", SimpleFilterFactory<show_line_numbers>("line_numbers"));
|
||||
registry.register_factory("hlcpp", SimpleFilterFactory<colorize_cplusplus>("hlcpp"));
|
||||
}
|
||||
|
|
|
@ -1,20 +1,9 @@
|
|||
#ifndef filters_hh_INCLUDED
|
||||
#define filters_hh_INCLUDED
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include "display_buffer.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
void colorize_regex(DisplayBuffer& display_buffer,
|
||||
const boost::regex& ex, Color color);
|
||||
|
||||
void colorize_cplusplus(DisplayBuffer& display_buffer);
|
||||
void colorize_cplusplus(DisplayBuffer& display_buffer);
|
||||
void expand_tabulations(DisplayBuffer& display_buffer);
|
||||
void show_line_numbers(DisplayBuffer& display_buffer);
|
||||
|
||||
void register_filters();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "window.hh"
|
||||
|
||||
#include "assert.hh"
|
||||
#include "filters.hh"
|
||||
#include "filter_registry.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
@ -114,8 +114,11 @@ Window::Window(Buffer& buffer)
|
|||
m_current_inserter(nullptr)
|
||||
{
|
||||
m_selections.push_back(Selection(buffer.begin(), buffer.begin()));
|
||||
m_filters.push_back(FilterAndId("show_tabs", expand_tabulations));
|
||||
m_filters.push_back(FilterAndId("show_selection", HighlightSelections(*this)));
|
||||
|
||||
FilterRegistry& registry = FilterRegistry::instance();
|
||||
add_filter(registry.get_filter("expand_tabs", FilterParameters()));
|
||||
add_filter(FilterAndId("show_selections", HighlightSelections(*this)));
|
||||
add_filter(registry.get_filter("hlcpp", FilterParameters()));
|
||||
}
|
||||
|
||||
void Window::check_invariant() const
|
||||
|
|
Loading…
Reference in New Issue
Block a user