diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2011-11-09 14:06:05 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2011-11-09 14:06:05 +0000 |
| commit | 55c092eed903679c05b8fb644eb2b26782a5cd02 (patch) | |
| tree | 9f0f115b983b327a1e3d186e372c1d9a5876713d /src | |
| parent | 9f6635494816e471019dc2930453412942a150f3 (diff) | |
Filters: code cleanup
Diffstat (limited to 'src')
| -rw-r--r-- | src/filters.cc | 3 | ||||
| -rw-r--r-- | src/filters.hh | 11 | ||||
| -rw-r--r-- | src/window.cc | 9 |
3 files changed, 9 insertions, 14 deletions
diff --git a/src/filters.cc b/src/filters.cc index a7b6f3f9..6d9e99fb 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -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")); } diff --git a/src/filters.hh b/src/filters.hh index 310bc0c3..0d88da46 100644 --- a/src/filters.hh +++ b/src/filters.hh @@ -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(); } diff --git a/src/window.cc b/src/window.cc index 05ac628d..4b0fdd5f 100644 --- a/src/window.cc +++ b/src/window.cc @@ -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 |
