summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-03-07 20:17:41 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-03-07 20:17:41 +0000
commit52525a156ff2a9f5c8c6fbb2e933ec412afb4728 (patch)
tree59c28b335a05d8a29a5cf1028ff9861970d36419 /src/input_handler.cc
parent7202ff373e7d789b030a802062b88e1e32f2ccd9 (diff)
Remove complete_prefix option and behaviour
Now that we use subsequence based completion almost everywhere, completing the common prefix does not make sense anymore.
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc49
1 files changed, 7 insertions, 42 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 1f307f67..3871398d 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -762,51 +762,16 @@ 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
- context().options()["complete_prefix"].get<bool>())
- {
- const String& line = m_line_editor.line();
- CandidateList& candidates = m_completions.candidates;
- String prefix = common_prefix(candidates);
- if (m_completions.end - m_completions.start > prefix.length())
- prefix = line.substr(m_completions.start,
- m_completions.end - m_completions.start).str();
-
- if (not prefix.empty())
- {
- auto it = find(candidates, prefix);
- if (it == candidates.end())
- {
- m_current_completion = candidates.size();
- candidates.push_back(prefix);
- }
- else
- m_current_completion = it - candidates.begin();
-
- CharCount start = line.char_count_to(m_completions.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)
- {
- if (not reverse and ++m_current_completion >= candidates.size())
- m_current_completion = 0;
- else if (reverse and --m_current_completion < 0)
- m_current_completion = candidates.size()-1;
- }
+ if (candidates.empty())
+ return;
+
+ if (not reverse and ++m_current_completion >= candidates.size())
+ m_current_completion = 0;
+ else if (reverse and --m_current_completion < 0)
+ m_current_completion = candidates.size()-1;
const String& completion = candidates[m_current_completion];
if (context().has_client())