2013-09-12 23:47:23 +02:00
|
|
|
#ifndef client_hh_INCLUDED
|
|
|
|
#define client_hh_INCLUDED
|
2012-06-06 01:15:19 +02:00
|
|
|
|
2013-09-16 20:15:13 +02:00
|
|
|
#include "display_buffer.hh"
|
2014-04-07 22:25:44 +02:00
|
|
|
#include "env_vars.hh"
|
2014-08-12 01:30:13 +02:00
|
|
|
#include "input_handler.hh"
|
|
|
|
#include "safe_ptr.hh"
|
|
|
|
#include "utils.hh"
|
2014-11-11 00:29:16 +01:00
|
|
|
#include "option_manager.hh"
|
2012-06-06 01:15:19 +02:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
2013-11-14 22:12:59 +01:00
|
|
|
class UserInterface;
|
2013-12-20 21:10:08 +01:00
|
|
|
class Window;
|
2014-11-12 22:27:07 +01:00
|
|
|
class String;
|
2014-11-25 02:00:18 +01:00
|
|
|
struct Key;
|
|
|
|
|
|
|
|
enum class EventMode;
|
2013-11-14 19:09:15 +01:00
|
|
|
|
2014-11-11 00:29:16 +01:00
|
|
|
class Client : public SafeCountable, public OptionManagerWatcher
|
2013-11-14 19:09:15 +01:00
|
|
|
{
|
|
|
|
public:
|
2013-12-20 21:10:08 +01:00
|
|
|
Client(std::unique_ptr<UserInterface>&& ui,
|
|
|
|
std::unique_ptr<Window>&& window,
|
2014-04-07 22:25:44 +02:00
|
|
|
SelectionList selections,
|
|
|
|
EnvVarMap env_vars,
|
|
|
|
String name);
|
2013-11-14 19:09:15 +01:00
|
|
|
~Client();
|
|
|
|
|
2014-11-11 00:29:16 +01:00
|
|
|
Client(Client&&) = delete;
|
|
|
|
|
2013-11-14 19:09:15 +01:00
|
|
|
// handle all the keys currently available in the user interface
|
2014-11-25 02:00:18 +01:00
|
|
|
void handle_available_input(EventMode mode);
|
2013-11-14 19:09:15 +01:00
|
|
|
|
2013-09-16 20:15:13 +02:00
|
|
|
void print_status(DisplayLine status_line);
|
|
|
|
|
|
|
|
void redraw_ifn();
|
|
|
|
|
2013-09-12 23:39:34 +02:00
|
|
|
UserInterface& ui() const { return *m_ui; }
|
2013-12-20 21:10:08 +01:00
|
|
|
Window& window() const { return *m_window; }
|
2013-10-15 19:50:43 +02:00
|
|
|
|
2013-10-15 19:51:31 +02:00
|
|
|
void check_buffer_fs_timestamp();
|
|
|
|
|
2013-11-14 19:09:15 +01:00
|
|
|
Context& context() { return m_input_handler.context(); }
|
|
|
|
const Context& context() const { return m_input_handler.context(); }
|
|
|
|
|
2014-08-12 20:24:09 +02:00
|
|
|
InputHandler& input_handler() { return m_input_handler; }
|
|
|
|
const InputHandler& input_handler() const { return m_input_handler; }
|
|
|
|
|
2013-12-20 21:10:08 +01:00
|
|
|
void change_buffer(Buffer& buffer);
|
2013-10-10 22:34:19 +02:00
|
|
|
|
2014-12-20 19:40:17 +01:00
|
|
|
StringView get_env_var(const String& name) const;
|
2014-04-07 22:25:44 +02:00
|
|
|
|
2013-12-20 21:10:08 +01:00
|
|
|
private:
|
2014-11-11 00:29:16 +01:00
|
|
|
void on_option_changed(const Option& option) override;
|
|
|
|
|
2014-11-29 21:14:52 +01:00
|
|
|
Optional<Key> get_next_key(EventMode mode);
|
|
|
|
|
2013-10-10 22:34:19 +02:00
|
|
|
DisplayLine generate_mode_line() const;
|
|
|
|
|
2013-09-12 23:39:34 +02:00
|
|
|
std::unique_ptr<UserInterface> m_ui;
|
2013-12-20 21:10:08 +01:00
|
|
|
std::unique_ptr<Window> m_window;
|
|
|
|
|
2014-04-07 22:25:44 +02:00
|
|
|
EnvVarMap m_env_vars;
|
|
|
|
|
2013-12-20 21:10:08 +01:00
|
|
|
InputHandler m_input_handler;
|
2013-02-18 14:07:30 +01:00
|
|
|
|
2013-09-16 20:15:13 +02:00
|
|
|
DisplayLine m_status_line;
|
2014-08-12 20:19:46 +02:00
|
|
|
DisplayLine m_pending_status_line;
|
2014-07-07 21:13:08 +02:00
|
|
|
DisplayLine m_mode_line;
|
2014-11-25 02:00:18 +01:00
|
|
|
|
2015-01-12 14:45:44 +01:00
|
|
|
Vector<Key> m_pending_keys;
|
2012-06-06 01:15:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-09-12 23:47:23 +02:00
|
|
|
#endif // client_hh_INCLUDED
|