From 99eaa259e6f4bd0e9fa81c1db3b802b7e5f7a306 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 15 Aug 2012 17:32:46 +0200 Subject: [PATCH] Context: do not store buffer, ask editor for it --- src/context.hh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/context.hh b/src/context.hh index 5a863c24..cc4e4fe6 100644 --- a/src/context.hh +++ b/src/context.hh @@ -12,19 +12,19 @@ struct Context { Context() {} Context(Editor& editor) - : m_editor(&editor), m_buffer(&editor.buffer()) {} + : m_editor(&editor) {} // to allow func(Context(Editor(...))) Context(Editor&& editor) - : m_editor(&editor), m_buffer(&editor.buffer()) {} + : m_editor(&editor) {} Buffer& buffer() const { if (not has_buffer()) throw runtime_error("no buffer in context"); - return *m_buffer; + return m_editor->buffer(); } - bool has_buffer() const { return m_buffer; } + bool has_buffer() const { return m_editor; } Editor& editor() const { @@ -56,8 +56,6 @@ struct Context public: safe_ptr m_editor; - safe_ptr m_buffer; - int m_numeric_param = 0; };