parent
bde726d034
commit
d23ac09fc1
|
@ -739,3 +739,6 @@ The following keys are recognized by this mode to help with editing (See <<comma
|
||||||
*<a-!>*::
|
*<a-!>*::
|
||||||
expand the typed expansions in currently entered text
|
expand the typed expansions in currently entered text
|
||||||
(See <<expansions#typed-expansions,`:doc expansions typed-expansions`>>)
|
(See <<expansions#typed-expansions,`:doc expansions typed-expansions`>>)
|
||||||
|
|
||||||
|
*<a-;>*::
|
||||||
|
escape to normal mode for a single command
|
||||||
|
|
|
@ -175,11 +175,14 @@ public:
|
||||||
context().client().check_if_buffer_needs_reloading();
|
context().client().check_if_buffer_needs_reloading();
|
||||||
timer.set_next_date(Clock::now() + get_fs_check_timeout(context()));
|
timer.set_next_date(Clock::now() + get_fs_check_timeout(context()));
|
||||||
}}},
|
}}},
|
||||||
m_single_command(single_command)
|
m_state(single_command ? State::SingleCommand : State::Normal)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void on_enabled() override
|
void on_enabled() override
|
||||||
{
|
{
|
||||||
|
if (m_state == State::PopOnEnabled)
|
||||||
|
return pop_mode();
|
||||||
|
|
||||||
if (not (context().flags() & Context::Flags::Draft))
|
if (not (context().flags() & Context::Flags::Draft))
|
||||||
{
|
{
|
||||||
if (context().has_client())
|
if (context().has_client())
|
||||||
|
@ -214,6 +217,7 @@ public:
|
||||||
|
|
||||||
void on_key(Key key) override
|
void on_key(Key key) override
|
||||||
{
|
{
|
||||||
|
kak_assert(m_state != State::PopOnEnabled);
|
||||||
ScopedSetBool set_in_on_key{m_in_on_key};
|
ScopedSetBool set_in_on_key{m_in_on_key};
|
||||||
|
|
||||||
// Hack to parse keys sent by terminals using the 8th bit to mark the
|
// Hack to parse keys sent by terminals using the 8th bit to mark the
|
||||||
|
@ -283,11 +287,12 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Preserve hooks disabled for the whole execution prior to pop_mode
|
auto pop_if_single_command = on_scope_end([this] {
|
||||||
ScopedSetBool disable_hooks{context().hooks_disabled(),
|
if (m_state == State::SingleCommand and enabled())
|
||||||
m_single_command and m_hooks_disabled};
|
|
||||||
if (m_single_command)
|
|
||||||
pop_mode();
|
pop_mode();
|
||||||
|
else if (m_state == State::SingleCommand)
|
||||||
|
m_state = State::PopOnEnabled;
|
||||||
|
});
|
||||||
|
|
||||||
context().print_status({});
|
context().print_status({});
|
||||||
if (context().has_client())
|
if (context().has_client())
|
||||||
|
@ -350,7 +355,9 @@ private:
|
||||||
Timer m_idle_timer;
|
Timer m_idle_timer;
|
||||||
Timer m_fs_check_timer;
|
Timer m_fs_check_timer;
|
||||||
MouseHandler m_mouse_handler;
|
MouseHandler m_mouse_handler;
|
||||||
const bool m_single_command;
|
|
||||||
|
enum class State { Normal, SingleCommand, PopOnEnabled };
|
||||||
|
State m_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<WordType word_type>
|
template<WordType word_type>
|
||||||
|
@ -897,6 +904,11 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (key == alt(';'))
|
||||||
|
{
|
||||||
|
push_mode(new Normal(context().input_handler(), true));
|
||||||
|
return;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_line_editor.handle_key(key);
|
m_line_editor.handle_key(key);
|
||||||
|
@ -999,9 +1011,11 @@ private:
|
||||||
m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context()));
|
m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_disabled(bool) override
|
void on_disabled(bool temporary) override
|
||||||
{
|
{
|
||||||
|
if (not temporary)
|
||||||
context().print_status({});
|
context().print_status({});
|
||||||
|
|
||||||
m_idle_timer.set_next_date(TimePoint::max());
|
m_idle_timer.set_next_date(TimePoint::max());
|
||||||
if (context().has_client())
|
if (context().has_client())
|
||||||
context().client().menu_hide();
|
context().client().menu_hide();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "·" }, { "face": { "fg": "black", "bg": "cyan", "attributes": [] }, "contents": "¬" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "¬" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }
|
{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "·" }, { "face": { "fg": "black", "bg": "cyan", "attributes": [] }, "contents": "¬" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "¬" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }
|
||||||
{ "jsonrpc": "2.0", "method": "menu_hide", "params": [] }
|
{ "jsonrpc": "2.0", "method": "menu_hide", "params": [] }
|
||||||
{ "jsonrpc": "2.0", "method": "info_hide", "params": [] }
|
{ "jsonrpc": "2.0", "method": "info_hide", "params": [] }
|
||||||
{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:2 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "[+]" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "yellow", "bg": "default", "attributes": [] }, "contents": "insert" }, { "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sels (1)" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] }
|
{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:2 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "[+]" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] }
|
||||||
{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 1 }] }
|
{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 1 }] }
|
||||||
{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }
|
{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }
|
||||||
{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "·" }, { "face": { "fg": "black", "bg": "cyan", "attributes": [] }, "contents": "¬" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "¬" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }
|
{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "·" }, { "face": { "fg": "black", "bg": "cyan", "attributes": [] }, "contents": "¬" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "¬" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user