move Client::Mode class definition in client.cc
This commit is contained in:
parent
b3c4912404
commit
0380c999c3
|
@ -10,6 +10,19 @@ namespace Kakoune
|
||||||
|
|
||||||
extern std::unordered_map<Key, std::function<void (Context& context)>> keymap;
|
extern std::unordered_map<Key, std::function<void (Context& context)>> keymap;
|
||||||
|
|
||||||
|
class Client::Mode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Mode(Client& client) : m_client(client) {}
|
||||||
|
virtual ~Mode() {}
|
||||||
|
Mode(const Mode&) = delete;
|
||||||
|
Mode& operator=(const Mode&) = delete;
|
||||||
|
|
||||||
|
virtual void on_key(const Key& key, Context& context) = 0;
|
||||||
|
protected:
|
||||||
|
Client& m_client;
|
||||||
|
};
|
||||||
|
|
||||||
class Client::NormalMode : public Client::Mode
|
class Client::NormalMode : public Client::Mode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -374,6 +387,10 @@ Client::Client()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Client::~Client()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void Client::insert(Editor& editor, IncrementalInserter::Mode mode)
|
void Client::insert(Editor& editor, IncrementalInserter::Mode mode)
|
||||||
{
|
{
|
||||||
m_mode.reset(new InsertMode(*this, editor, mode));
|
m_mode.reset(new InsertMode(*this, editor, mode));
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Client : public SafeCountable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Client();
|
Client();
|
||||||
virtual ~Client() {}
|
virtual ~Client();
|
||||||
virtual void draw_window(Window& window) = 0;
|
virtual void draw_window(Window& window) = 0;
|
||||||
virtual void print_status(const String& status,
|
virtual void print_status(const String& status,
|
||||||
CharCount cursor_pos = -1) = 0;
|
CharCount cursor_pos = -1) = 0;
|
||||||
|
@ -49,18 +49,7 @@ private:
|
||||||
void reset_normal_mode();
|
void reset_normal_mode();
|
||||||
std::pair<IncrementalInserter::Mode, std::vector<Key>> m_last_insert;
|
std::pair<IncrementalInserter::Mode, std::vector<Key>> m_last_insert;
|
||||||
|
|
||||||
class Mode
|
class Mode;
|
||||||
{
|
|
||||||
public:
|
|
||||||
Mode(Client& client) : m_client(client) {}
|
|
||||||
virtual ~Mode() {}
|
|
||||||
Mode(const Mode&) = delete;
|
|
||||||
Mode& operator=(const Mode&) = delete;
|
|
||||||
|
|
||||||
virtual void on_key(const Key& key, Context& context) = 0;
|
|
||||||
protected:
|
|
||||||
Client& m_client;
|
|
||||||
};
|
|
||||||
std::unique_ptr<Mode> m_mode;
|
std::unique_ptr<Mode> m_mode;
|
||||||
|
|
||||||
class NormalMode;
|
class NormalMode;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user