diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-06-09 19:29:40 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-06-09 19:29:40 +0100 |
| commit | f54f8818c6a908fa3e797c6bb05b270ddeda1d77 (patch) | |
| tree | 77d2a156632c8f89e652ad440b51e071b91bc0d0 /src/input_handler.cc | |
| parent | 1ffafa865067ea7e8f01233279b936b51a9fc193 (diff) | |
| parent | 4834504508bdbde70c536bad28260cbaabc6ceec (diff) | |
Merge branch 'master' into remove-buffer-change-listener
Diffstat (limited to 'src/input_handler.cc')
| -rw-r--r-- | src/input_handler.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc index d5312305..bfbe12a7 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -451,12 +451,14 @@ public: const bool reverse = (key == Key::BackTab); CandidateList& candidates = m_completions.candidates; // first try, we need to ask our completer for completions + bool updated_completions = false; if (candidates.empty()) { refresh_completions(CompletionFlags::None); if (candidates.empty()) return; + updated_completions = true; } bool did_prefix = false; if (m_current_completion == -1 and @@ -481,7 +483,10 @@ public: m_current_completion = it - candidates.begin(); CharCount start = line.char_count_to(m_completions.start); - did_prefix = prefix != line.substr(start, m_line_editor.cursor_pos() - start); + // When we just updated completions, select the common + // prefix even if it was the currently entered text. + did_prefix = updated_completions or + prefix != line.substr(start, m_line_editor.cursor_pos() - start); } } if (not did_prefix) @@ -545,6 +550,7 @@ private: { if (not m_completer) return; + m_current_completion = -1; const String& line = m_line_editor.line(); m_completions = m_completer(context(), flags, line, line.byte_count_to(m_line_editor.cursor_pos())); |
