Fix prompt completion

This commit is contained in:
Maxime Coste 2013-11-18 21:47:16 +00:00
parent 56c0d2de95
commit f57f065d76

View File

@ -321,7 +321,7 @@ public:
{ {
m_history_it = ms_history[m_prompt].end(); m_history_it = ms_history[m_prompt].end();
if (context().options()["autoshowcompl"].get<bool>()) if (context().options()["autoshowcompl"].get<bool>())
refresh_completions(); refresh_completions(CompletionFlags::Fast);
display(); display();
} }
@ -411,7 +411,7 @@ public:
// first try, we need to ask our completer for completions // first try, we need to ask our completer for completions
if (candidates.empty()) if (candidates.empty())
{ {
refresh_completions(); refresh_completions(CompletionFlags::None);
if (candidates.empty()) if (candidates.empty())
return; return;
@ -462,7 +462,7 @@ public:
} }
if (showcompl and context().options()["autoshowcompl"].get<bool>()) if (showcompl and context().options()["autoshowcompl"].get<bool>())
refresh_completions(); refresh_completions(CompletionFlags::Fast);
display(); display();
m_callback(line, PromptEvent::Change, context()); m_callback(line, PromptEvent::Change, context());
@ -485,12 +485,12 @@ public:
KeymapMode keymap_mode() const override { return KeymapMode::Prompt; } KeymapMode keymap_mode() const override { return KeymapMode::Prompt; }
private: private:
void refresh_completions() void refresh_completions(CompletionFlags flags)
{ {
try try
{ {
const String& line = m_line_editor.line(); const String& line = m_line_editor.line();
m_completions = m_completer(context(), CompletionFlags::Fast, line, m_completions = m_completer(context(), flags, line,
line.byte_count_to(m_line_editor.cursor_pos())); line.byte_count_to(m_line_editor.cursor_pos()));
CandidateList& candidates = m_completions.candidates; CandidateList& candidates = m_completions.candidates;
if (context().has_ui() and not candidates.empty()) if (context().has_ui() and not candidates.empty())