Skip to content

Commit

Permalink
Merge pull request #66511 from ClickHouse/disable-ctrl-z
Browse files Browse the repository at this point in the history
Disable suspend on Ctrl+Z in the interactive mode
  • Loading branch information
alexey-milovidov authored Jul 16, 2024
2 parents 8f60b97 + 390ed8d commit 2270706
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Client/ClientBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#include <Common/config_version.h>
#include "config.h"


namespace fs = std::filesystem;
using namespace std::literals;

Expand Down Expand Up @@ -2565,12 +2566,12 @@ void ClientBase::runInteractive()
word_break_characters,
highlight_callback);
#else
(void)word_break_characters;
LineReader lr(
history_file,
getClientConfiguration().has("multiline"),
query_extenders,
query_delimiters,
word_break_characters);
query_delimiters);
#endif

static const std::initializer_list<std::pair<String, String>> backslash_aliases =
Expand Down
3 changes: 1 addition & 2 deletions src/Client/LineReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ class LineReader
Patterns delimiters,
std::istream & input_stream_ = std::cin,
std::ostream & output_stream_ = std::cout,
int in_fd_ = STDIN_FILENO
);
int in_fd_ = STDIN_FILENO);

virtual ~LineReader() = default;

Expand Down
3 changes: 3 additions & 0 deletions src/Client/ReplxxLineReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ ReplxxLineReader::ReplxxLineReader(
rx.bind_key(Replxx::KEY::control('N'), [this](char32_t code) { return rx.invoke(Replxx::ACTION::HISTORY_NEXT, code); });
rx.bind_key(Replxx::KEY::control('P'), [this](char32_t code) { return rx.invoke(Replxx::ACTION::HISTORY_PREVIOUS, code); });

/// We don't want the default, "suspend" behavior, it confuses people.
rx.bind_key_internal(replxx::Replxx::KEY::control('Z'), "insert_character");

auto commit_action = [this](char32_t code)
{
/// If we allow multiline and there is already something in the input, start a newline.
Expand Down

0 comments on commit 2270706

Please sign in to comment.