summaryrefslogtreecommitdiff
path: root/src/context.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-12-20 20:10:08 +0000
committerMaxime Coste <frrrwww@gmail.com>2013-12-20 20:14:57 +0000
commitc0973075fafc7003be1028922bf99a2c48bcdcd6 (patch)
tree303d3d6b03942857775f7c0d2e15d621a6f6df37 /src/context.hh
parentcb324a4b8842d6d45a7dba316cd4f909addb99c2 (diff)
Get rid of Editor for good
ClientManager now stores only the free windows, clients take ownership of its own.
Diffstat (limited to 'src/context.hh')
-rw-r--r--src/context.hh20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/context.hh b/src/context.hh
index 54c79490..60d76c71 100644
--- a/src/context.hh
+++ b/src/context.hh
@@ -3,6 +3,8 @@
#include "dynamic_selection_list.hh"
+#include <boost/optional.hpp>
+
namespace Kakoune
{
@@ -25,21 +27,17 @@ class Context
{
public:
Context();
- Context(InputHandler& input_handler, Editor& editor, String name = "");
- Context(Editor& editor, String name = "");
+ Context(InputHandler& input_handler, Buffer& buffer, SelectionList selections, String name = "");
~Context();
Context(const Context&) = delete;
Context& operator=(const Context&) = delete;
Buffer& buffer() const;
- bool has_buffer() const { return (bool)m_editor; }
-
- Editor& editor() const;
- bool has_editor() const { return (bool)m_editor; }
+ bool has_buffer() const { return m_selections; }
Window& window() const;
- bool has_window() const;
+ bool has_window() const { return (bool)m_window; }
Client& client() const;
bool has_client() const { return (bool)m_client; }
@@ -54,9 +52,10 @@ public:
const SelectionList& selections() const;
std::vector<String> selections_content() const;
- void change_editor(Editor& editor);
+ void change_buffer(Buffer& buffer);
void set_client(Client& client);
+ void set_window(Window& window);
OptionManager& options() const;
HookManager& hooks() const;
@@ -81,10 +80,13 @@ private:
friend struct ScopedEdition;
- safe_ptr<Editor> m_editor;
safe_ptr<InputHandler> m_input_handler;
+ safe_ptr<Window> m_window;
safe_ptr<Client> m_client;
+ friend class Client;
+ boost::optional<DynamicSelectionList> m_selections;
+
String m_name;
using JumpList = std::vector<DynamicSelectionList>;