mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
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)
This commit is contained in:
@@ -2296,8 +2296,10 @@ extern "C" char **new_mysql_completion (const char *text, int start, int end);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(USE_NEW_READLINE_INTERFACE)
|
#if defined(USE_NEW_READLINE_INTERFACE)
|
||||||
|
static int fake_magic_space(int, int);
|
||||||
extern "C" char *no_completion(const char*,int)
|
extern "C" char *no_completion(const char*,int)
|
||||||
#elif defined(USE_LIBEDIT_INTERFACE)
|
#elif defined(USE_LIBEDIT_INTERFACE)
|
||||||
|
static int fake_magic_space(const char *, int);
|
||||||
extern "C" int no_completion(const char*,int)
|
extern "C" int no_completion(const char*,int)
|
||||||
#else
|
#else
|
||||||
extern "C" char *no_completion()
|
extern "C" char *no_completion()
|
||||||
@@ -2374,6 +2376,18 @@ static int not_in_history(const char *line)
|
|||||||
return 1;
|
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)
|
static void initialize_readline (char *name)
|
||||||
{
|
{
|
||||||
/* Allow conditional parsing of the ~/.inputrc file. */
|
/* Allow conditional parsing of the ~/.inputrc file. */
|
||||||
@@ -2383,12 +2397,15 @@ static void initialize_readline (char *name)
|
|||||||
#if defined(USE_NEW_READLINE_INTERFACE)
|
#if defined(USE_NEW_READLINE_INTERFACE)
|
||||||
rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion;
|
rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion;
|
||||||
rl_completion_entry_function= (rl_compentry_func_t*)&no_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)
|
#elif defined(USE_LIBEDIT_INTERFACE)
|
||||||
#ifdef HAVE_LOCALE_H
|
#ifdef HAVE_LOCALE_H
|
||||||
setlocale(LC_ALL,""); /* so as libedit use isprint */
|
setlocale(LC_ALL,""); /* so as libedit use isprint */
|
||||||
#endif
|
#endif
|
||||||
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
|
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
|
||||||
rl_completion_entry_function= &no_completion;
|
rl_completion_entry_function= &no_completion;
|
||||||
|
rl_add_defun("magic-space", (Function*)&fake_magic_space, -1);
|
||||||
#else
|
#else
|
||||||
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
|
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
|
||||||
rl_completion_entry_function= &no_completion;
|
rl_completion_entry_function= &no_completion;
|
||||||
|
Reference in New Issue
Block a user