summaryrefslogtreecommitdiff
path: root/src/insert_completer.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-05-14 00:59:36 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-05-14 19:49:04 +0100
commitbf98b38afd5338f6be617cfaf4bb251eb011e2b0 (patch)
tree7832efaa75e4a6da23d57cf2672d60ce59c779d7 /src/insert_completer.cc
parentdb423e4a88be8799ce0cfae33ddbf4c6bae97e5f (diff)
Use a plain SelectionList for Context, remove DynamicSelectionList
Diffstat (limited to 'src/insert_completer.cc')
-rw-r--r--src/insert_completer.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/insert_completer.cc b/src/insert_completer.cc
index 7b7d52fe..def3b951 100644
--- a/src/insert_completer.cc
+++ b/src/insert_completer.cc
@@ -185,13 +185,14 @@ void InsertCompleter::select(int offset)
if (m_current_candidate < 0)
m_current_candidate += m_matching_candidates.size();
const String& candidate = m_matching_candidates[m_current_candidate];
- const auto& cursor_pos = m_context.selections().main().cursor();
+ auto& selections = m_context.selections();
+ const auto& cursor_pos = selections.main().cursor();
const auto prefix_len = buffer.distance(m_completions.begin, cursor_pos);
const auto suffix_len = std::max(0_byte, buffer.distance(cursor_pos, m_completions.end));
const auto buffer_len = buffer.byte_count();
auto ref = buffer.string(m_completions.begin, m_completions.end);
- for (auto& sel : m_context.selections())
+ for (auto& sel : selections)
{
auto offset = buffer.offset(sel.cursor());
auto pos = buffer.iterator_at(sel.cursor());
@@ -200,6 +201,7 @@ void InsertCompleter::select(int offset)
{
pos = buffer.erase(pos - prefix_len, pos + suffix_len);
buffer.insert(pos, candidate);
+ const_cast<SelectionList&>(selections).update();
}
}
m_completions.end = cursor_pos;