Prompt: add <a-!> to expand the typed expansions in current line

Fixes #1952
This commit is contained in:
Maxime Coste 2018-04-04 11:00:25 +10:00
parent e6a9e14872
commit 6ee60ff9d7
2 changed files with 17 additions and 0 deletions

View File

@ -707,3 +707,7 @@ The following keys are recognized by this mode to help edition.
*<c-o>*:: *<c-o>*::
disable auto completion for this prompt disable auto completion for this prompt
*<a-!>*::
expand the typed expansions in currently entered text
(See <<expansions#typed-expansions,`:doc expansions typed-expansions`>>)

View File

@ -4,6 +4,7 @@
#include "buffer_manager.hh" #include "buffer_manager.hh"
#include "buffer_utils.hh" #include "buffer_utils.hh"
#include "command_manager.hh"
#include "client.hh" #include "client.hh"
#include "event_manager.hh" #include "event_manager.hh"
#include "face_registry.hh" #include "face_registry.hh"
@ -875,6 +876,18 @@ public:
if (context().has_client()) if (context().has_client())
context().client().menu_hide(); context().client().menu_hide();
} }
else if (key == alt('!'))
{
try
{
m_line_editor.reset(expand(m_line_editor.line(), context()), m_empty_text);
}
catch (std::runtime_error& error)
{
context().print_status({error.what(), get_face("Error")});
return;
}
}
else else
{ {
m_line_editor.handle_key(key); m_line_editor.handle_key(key);