aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader.cpp
diff options
context:
space:
mode:
authorGravatar Yannis Chatzimichos <feedward@gmail.com>2013-02-18 08:20:31 +0200
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-02-20 18:07:38 -0800
commitf1d923714a0d53f6d91ef6ba10dfa0360c1e7007 (patch)
tree3ef98d7ff5a455c25daddf3552b675bbacd42192 /reader.cpp
parentb9ba227733ed5beb1a343035ad0d5602864328cf (diff)
Clear the autosuggestion from the old commandline when showing the completion list. Fixes #561
Diffstat (limited to 'reader.cpp')
-rw-r--r--reader.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/reader.cpp b/reader.cpp
index ac8b05ef..7c89a560 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<completion_t> &comp)
parse_util_get_parameter_info(data->command_line, data->buff_pos, &quote, 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);