Fix autocomplete on empty prompt

This commit is contained in:
Zachary Yedidia
2018-01-10 15:41:49 -05:00
parent 3f01101da4
commit 7e3aa337f6

View File

@@ -323,7 +323,7 @@ func (m *Messenger) Prompt(prompt, placeholder, historyType string, completionTy
chosen = chosen + CommonSubstring(suggestions...) chosen = chosen + CommonSubstring(suggestions...)
} }
if len(suggestions) != 0 { if len(suggestions) != 0 && chosen != "" {
m.response = shellwords.Join(append(args[:len(args)-1], chosen)...) m.response = shellwords.Join(append(args[:len(args)-1], chosen)...)
m.cursorx = Count(m.response) m.cursorx = Count(m.response)
} }