InputHandler: tweak prefix completion behaviour

This commit is contained in:
Maxime Coste 2012-12-07 19:17:49 +01:00
parent 158f5a5c84
commit afc8ad77e8

View File

@ -353,9 +353,9 @@ public:
context.ui().menu_show(candidates, menu_pos, MenuStyle::Prompt); context.ui().menu_show(candidates, menu_pos, MenuStyle::Prompt);
bool use_common_prefix = context.options()["complete_prefix"].as_int(); bool use_common_prefix = context.options()["complete_prefix"].as_int();
String prefix = use_common_prefix ? String prefix = use_common_prefix ? common_prefix(candidates) : String();
common_prefix(candidates) if (m_completions.end - m_completions.start > prefix.length())
: line.substr(m_completions.start, prefix = line.substr(m_completions.start,
m_completions.end - m_completions.start); m_completions.end - m_completions.start);
auto it = find(candidates, prefix); auto it = find(candidates, prefix);