mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 20:20:17 +01:00
cli: initialize readline before installing the redisplay handler
Otherwise readline decides to initialize terminal handling at the first
readline call, and if that happens at the point it sees our
non-echoing rl_redisplay.
At that point, unless already intialized, readline wrongly convinces itself we
do our own handling of terminal peculiarities (such as cursor movement, or
erases). We do not -- we merely wrap the stock rl_redisplay(), temporarily
hiding the actual characters.
The rl_initialize() in nmc_readline_echo()s fixes broken line editing in
password prompts that weren't preceded a previous non-password prompt.
The other one is there for consistency only. (I guess we should be
initializing readline before use anyway; although it seems to initialize
itself anyway if we fail to do so...)
https://github.com/NetworkManager/NetworkManager/pull/241
(cherry picked from commit 05d6c993dd)
This commit is contained in:
parent
2e5d0f3046
commit
576f0877f3
1 changed files with 4 additions and 0 deletions
|
|
@ -931,6 +931,8 @@ nmc_readline (const char *prompt_fmt, ...)
|
|||
va_list args;
|
||||
char *prompt, *str;
|
||||
|
||||
rl_initialize ();
|
||||
|
||||
va_start (args, prompt_fmt);
|
||||
prompt = g_strdup_vprintf (prompt_fmt, args);
|
||||
va_end (args);
|
||||
|
|
@ -985,6 +987,8 @@ nmc_readline_echo (gboolean echo_on, const char *prompt_fmt, ...)
|
|||
prompt = g_strdup_vprintf (prompt_fmt, args);
|
||||
va_end (args);
|
||||
|
||||
rl_initialize ();
|
||||
|
||||
/* Hide the actual password */
|
||||
if (!echo_on) {
|
||||
saved_history = history_get_history_state ();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue