diff options
author | Jim Winstead <jimw@mysql.com> | 2009-05-19 10:17:05 -0700 |
---|---|---|
committer | Jim Winstead <jimw@mysql.com> | 2009-05-19 10:17:05 -0700 |
commit | e2808aa217745689577ce978af040b65853fd006 (patch) | |
tree | 92e4f18b48f6743a3b8b9ed4592eaa1772062e81 /client | |
parent | 9796aec8763298883fff11254bdbd2dd2ad0781d (diff) | |
download | mariadb-git-e2808aa217745689577ce978af040b65853fd006.tar.gz |
The mysql command-line client didn't implement the readline magic-space
command, which bash does, which could result in a user accidentally disabling
the use of the space key in the mysql command-line client. (Bug #27439)
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 8de3cfee041..5752017bbff 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2296,8 +2296,10 @@ extern "C" char **new_mysql_completion (const char *text, int start, int end); */ #if defined(USE_NEW_READLINE_INTERFACE) +static int fake_magic_space(int, int); extern "C" char *no_completion(const char*,int) #elif defined(USE_LIBEDIT_INTERFACE) +static int fake_magic_space(const char *, int); extern "C" int no_completion(const char*,int) #else extern "C" char *no_completion() @@ -2374,6 +2376,18 @@ static int not_in_history(const char *line) return 1; } + +#if defined(USE_NEW_READLINE_INTERFACE) +static int fake_magic_space(int, int) +#else +static int fake_magic_space(const char *, int) +#endif +{ + rl_insert(1, ' '); + return 0; +} + + static void initialize_readline (char *name) { /* Allow conditional parsing of the ~/.inputrc file. */ @@ -2383,12 +2397,15 @@ static void initialize_readline (char *name) #if defined(USE_NEW_READLINE_INTERFACE) rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion; rl_completion_entry_function= (rl_compentry_func_t*)&no_completion; + + rl_add_defun("magic-space", (rl_command_func_t *)&fake_magic_space, -1); #elif defined(USE_LIBEDIT_INTERFACE) #ifdef HAVE_LOCALE_H setlocale(LC_ALL,""); /* so as libedit use isprint */ #endif rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; rl_completion_entry_function= &no_completion; + rl_add_defun("magic-space", (Function*)&fake_magic_space, -1); #else rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; rl_completion_entry_function= &no_completion; |