shared/shell: Fix artifacts related to prompt 71/204971/1
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 13 Apr 2018 14:42:40 +0000 (17:42 +0300)
committerAmit Purwar <amit.purwar@samsung.com>
Mon, 29 Apr 2019 04:02:23 +0000 (09:32 +0530)
Both bt_shell_prompt_input and bt_shell_input could cause the prompt to
be printed incorrectly, so they now rely on bt_shell_printf which
properly check if input and prompt shall be saved/restored.

Change-Id: Idf305cd6c29515aaca28a240103d5b08bfe3dc52
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
src/shared/shell.c

index 6b81fd5..e7f17e0 100644 (file)
@@ -486,7 +486,8 @@ void bt_shell_printf(const char *fmt, ...)
        va_end(args);
 
        if (save_input) {
-               rl_restore_prompt();
+               if (!data.saved_prompt)
+                       rl_restore_prompt();
                rl_replace_line(saved_line, 0);
                rl_point = saved_point;
                rl_forced_update_display();