]> git.puffer.fish Git - matthieu/frr.git/commitdiff
vtysh: disable bracketed paste in readline
authorQuentin Young <qlyoung@qlyoung.net>
Mon, 8 Feb 2021 01:15:24 +0000 (20:15 -0500)
committerQuentin Young <qlyoung@qlyoung.net>
Mon, 8 Feb 2021 03:51:47 +0000 (22:51 -0500)
GNU Readline 8.1 enables bracketed paste by default. This results in
newlines not ending the readline() call, which breaks the ability of
users to paste in configs to vtysh's interactive shell.

Disable bracketed paste.

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
vtysh/vtysh.c

index 19e7ae29e97992727ce8ac9d9497f79c4fa469d0..74f13e1a44e8ae63094b6c76cfb47e8499bdd2a0 100644 (file)
@@ -3714,10 +3714,16 @@ static char *vtysh_completion_entry_function(const char *ignore,
 void vtysh_readline_init(void)
 {
        /* readline related settings. */
+       char *disable_bracketed_paste =
+               XSTRDUP(MTYPE_TMP, "set enable-bracketed-paste off");
+
        rl_initialize();
+       rl_parse_and_bind(disable_bracketed_paste);
        rl_bind_key('?', (rl_command_func_t *)vtysh_rl_describe);
        rl_completion_entry_function = vtysh_completion_entry_function;
        rl_attempted_completion_function = new_completion;
+
+       XFREE(MTYPE_TMP, disable_bracketed_paste);
 }
 
 char *vtysh_prompt(void)