summaryrefslogtreecommitdiff
path: root/src/window.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-06-14 13:19:38 +0000
committerMaxime Coste <frrrwww@gmail.com>2012-06-14 13:19:38 +0000
commitf7ee2801e9f74f4954c305a2dc75ee5d519c2ca0 (patch)
treea22d270ef960abf8d2943f03dd0fa4c3abb95898 /src/window.cc
parenta943e08dc7b93c065d83639862fbcf1dd2fcb9c1 (diff)
Windows call the WinSetOption hook when an option changes
Diffstat (limited to 'src/window.cc')
-rw-r--r--src/window.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/window.cc b/src/window.cc
index 2f32167f..e6fffa28 100644
--- a/src/window.cc
+++ b/src/window.cc
@@ -21,9 +21,18 @@ Window::Window(Buffer& buffer)
HighlighterRegistry& registry = HighlighterRegistry::instance();
m_hook_manager.run_hook("WinCreate", buffer.name(), Context(*this));
+ m_option_manager.register_watcher(*this);
registry.add_highlighter_to_group(*this, m_highlighters, "expand_tabs", HighlighterParameters());
registry.add_highlighter_to_group(*this, m_highlighters, "highlight_selections", HighlighterParameters());
+
+ for (auto& option : m_option_manager.flatten_options())
+ on_option_changed(option.first, option.second);
+}
+
+Window::~Window()
+{
+ m_option_manager.unregister_watcher(*this);
}
BufferIterator Window::iterator_at(const DisplayCoord& window_pos) const
@@ -126,4 +135,11 @@ void Window::on_incremental_insertion_end()
pop_selections();
}
+void Window::on_option_changed(const String& name, const Option& option)
+{
+ String desc = name + "=" + option.as_string();
+ m_hook_manager.run_hook("WinSetOption", desc, Context(*this));
+}
+
+
}