diff options
Diffstat (limited to 'src/insert_completer.cc')
| -rw-r--r-- | src/insert_completer.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/insert_completer.cc b/src/insert_completer.cc index af387506..c50fbe00 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -413,7 +413,7 @@ InsertCompleter::~InsertCompleter() m_options.unregister_watcher(*this); } -void InsertCompleter::select(int index, bool relative, Vector<Key>& keystrokes) +void InsertCompleter::select(int index, bool relative, Vector<Key>* keystrokes) { m_enabled = true; if (not setup_ifn()) @@ -450,12 +450,15 @@ void InsertCompleter::select(int index, bool relative, Vector<Key>& keystrokes) m_context.client().menu_select(m_current_candidate); } - for (auto i = 0_byte; i < prefix_len; ++i) - keystrokes.emplace_back(Key::Backspace); - for (auto i = 0_byte; i < suffix_len; ++i) - keystrokes.emplace_back(Key::Delete); - for (auto& c : candidate.completion) - keystrokes.emplace_back(c); + if (keystrokes) + { + for (auto i = 0_byte; i < prefix_len; ++i) + keystrokes->emplace_back(Key::Backspace); + for (auto i = 0_byte; i < suffix_len; ++i) + keystrokes->emplace_back(Key::Delete); + for (auto& c : candidate.completion) + keystrokes->emplace_back(c); + } if (not candidate.on_select.empty()) CommandManager::instance().execute(candidate.on_select, m_context); |
