diff --git a/src/context.cc b/src/context.cc index 64bf8a4c..93bf8a7f 100644 --- a/src/context.cc +++ b/src/context.cc @@ -231,7 +231,7 @@ StringView Context::main_sel_register_value(StringView reg) const { auto strings = RegisterManager::instance()[reg].values(*this); size_t index = m_selections ? (*m_selections).main_index() : 0; - if (strings.size() < index) + if (strings.size() <= index) index = strings.size() - 1; return strings[index]; }