diff options
| author | Maxime Coste <mawww@kakoune.org> | 2023-05-15 21:10:02 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2023-05-21 16:20:51 +1000 |
| commit | cfa658b899b44a8a0f4c7f3dd9811ae0d44ddd3a (patch) | |
| tree | 80613249d2988b09ebc7eaa85a91f811959931f3 /src/client.cc | |
| parent | e140df8f0857125f40f9338450f73ff1ac50664d (diff) | |
Add <c-g> to cancel current operation
The current implementation only does this during regex operations,
but should be extensible to other operations that might take a long
time by regularly calling EventManager::handle_urgent_events().
Diffstat (limited to 'src/client.cc')
| -rw-r--r-- | src/client.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client.cc b/src/client.cc index f022c699..33285b95 100644 --- a/src/client.cc +++ b/src/client.cc @@ -53,6 +53,12 @@ Client::Client(std::unique_ptr<UserInterface>&& ui, killpg(getpgrp(), SIGINT); set_signal_handler(SIGINT, prev_handler); } + else if (key == ctrl('g')) + { + m_pending_keys.clear(); + print_status({"operation cancelled", context().faces()["Error"]}); + throw cancel{}; + } else if (key.modifiers & Key::Modifiers::Resize) { m_window->set_dimensions(key.coord()); @@ -110,7 +116,7 @@ bool Client::process_pending_inputs() catch (Kakoune::runtime_error& error) { write_to_debug_buffer(format("Error: {}", error.what())); - context().print_status({error.what().str(), context().faces()["Error"] }); + context().print_status({error.what().str(), context().faces()["Error"]}); context().hooks().run_hook(Hook::RuntimeError, error.what(), context()); } } |
