diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-12-07 19:17:49 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-12-07 19:20:26 +0100 |
| commit | afc8ad77e89a1c6c65cd63caeee468273c218314 (patch) | |
| tree | 50ce806665f36695e12ef9453b2df96e5f4ed684 /src/input_handler.cc | |
| parent | 158f5a5c84471618ab19e75a249e79e0ff0e7ef3 (diff) | |
InputHandler: tweak prefix completion behaviour
Diffstat (limited to 'src/input_handler.cc')
| -rw-r--r-- | src/input_handler.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc index 9a582467..9f8667f7 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -353,10 +353,10 @@ public: context.ui().menu_show(candidates, menu_pos, MenuStyle::Prompt); bool use_common_prefix = context.options()["complete_prefix"].as_int(); - String prefix = use_common_prefix ? - common_prefix(candidates) - : line.substr(m_completions.start, - m_completions.end - m_completions.start); + String prefix = use_common_prefix ? common_prefix(candidates) : String(); + if (m_completions.end - m_completions.start > prefix.length()) + prefix = line.substr(m_completions.start, + m_completions.end - m_completions.start); auto it = find(candidates, prefix); if (it == candidates.end()) |
