Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/curses/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,11 @@ void initScreen(bool enable_colors, bool enable_mouse)
rl_done = 1;
return 0;
};
// if ctrl-c or ctrl-g is pressed, abort the prompt
// if ctrl-c, ctrl-g, or escape is pressed, abort the prompt
rl_bind_key('\3', abort_prompt);
rl_bind_key('\7', abort_prompt);
rl_bind_keyseq("\\e", abort_prompt);
rl_variable_bind("keyseq-timeout", "25");
// do not change the state of the terminal
rl_prep_term_function = nullptr;
rl_deprep_term_function = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/curses/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const Type EoF = Special | 279;

}

/// Thrown if Ctrl-C or Ctrl-G is pressed during the call to Window::getString()
/// Thrown if Ctrl-C, Ctrl-G, or Escape is pressed during the call to Window::getString()
/// @see Window::getString()
struct PromptAborted : std::exception
{
Expand Down
2 changes: 1 addition & 1 deletion src/statusbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ char Statusbar::Helpers::promptReturnOneOf(const std::vector<char> &values)
{
wFooter->refresh();
result = wFooter->readKey();
if (result == NC::Key::Ctrl_C || result == NC::Key::Ctrl_G)
if (result == NC::Key::Ctrl_C || result == NC::Key::Ctrl_G || result == NC::Key::Escape)
throw NC::PromptAborted();
}
while (std::find(values.begin(), values.end(), result) == values.end());
Expand Down