summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-08-15 17:32:46 +0200
committerMaxime Coste <frrrwww@gmail.com>2012-08-15 17:32:46 +0200
commit99eaa259e6f4bd0e9fa81c1db3b802b7e5f7a306 (patch)
tree2b510bae33917009e6d2db04f8ede7fb3cad6681 /src
parent9e3323bf685a199801016fe6219cff5522981b2c (diff)
Context: do not store buffer, ask editor for it
Diffstat (limited to 'src')
-rw-r--r--src/context.hh10
1 files 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<Editor> m_editor;
- safe_ptr<Buffer> m_buffer;
-
int m_numeric_param = 0;
};