From f1d923714a0d53f6d91ef6ba10dfa0360c1e7007 Mon Sep 17 00:00:00 2001 From: Yannis Chatzimichos Date: Mon, 18 Feb 2013 08:20:31 +0200 Subject: [PATCH] Clear the autosuggestion from the old commandline when showing the completion list. Fixes #561 --- reader.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reader.cpp b/reader.cpp index ac8b05efe..7c89a5605 100644 --- a/reader.cpp +++ b/reader.cpp @@ -543,6 +543,15 @@ static void reader_repaint() data->repaint_needed = false; } +static void reader_repaint_without_autosuggestion() +{ + const wcstring saved_autosuggestion = data->autosuggestion; + + data->autosuggestion.clear(); + reader_repaint(); + data->autosuggestion = saved_autosuggestion; +} + /** Internal helper function for handling killing parts of text. */ @@ -1743,6 +1752,9 @@ static bool handle_completions(const std::vector &comp) parse_util_get_parameter_info(data->command_line, data->buff_pos, "e, NULL, NULL); is_quoted = (quote != L'\0'); + /* Clear the autosuggestion from the old commandline before abandoning it (see #561) */ + reader_repaint_without_autosuggestion(); + write_loop(1, "\n", 1); run_pager(prefix, is_quoted, comp);