mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01: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:
parent
8b218c54d4
commit
00920ce29b
1 changed files with 17 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue