minor cleanups in insert_completer.cc

This commit is contained in:
Maxime Coste 2014-05-31 18:18:29 +01:00
parent cf03cc97ef
commit 5bcb55b6dd

View File

@ -203,8 +203,8 @@ void InsertCompleter::select(int offset)
const_cast<SelectionList&>(selections).update(); const_cast<SelectionList&>(selections).update();
} }
} }
m_completions.end = cursor_pos; m_completions.end = cursor_pos;
m_completions.begin = buffer.advance(m_completions.end, -candidate.length()); m_completions.begin = buffer.advance(cursor_pos, -candidate.length());
m_completions.timestamp = buffer.timestamp(); m_completions.timestamp = buffer.timestamp();
if (m_context.has_ui()) if (m_context.has_ui())
m_context.ui().menu_select(m_current_candidate); m_context.ui().menu_select(m_current_candidate);
@ -227,8 +227,8 @@ void InsertCompleter::update()
ByteCoord cursor = m_context.selections().main().cursor(); ByteCoord cursor = m_context.selections().main().cursor();
ByteCoord compl_beg = m_completions.begin; ByteCoord compl_beg = m_completions.begin;
if (cursor.line == compl_beg.line and if (cursor.line == compl_beg.line and
is_in_range(cursor.column - compl_beg.column, is_in_range(cursor.column, compl_beg.column,
ByteCount{0}, longest_completion-1)) compl_beg.column + longest_completion-1))
{ {
String prefix = m_context.buffer().string(compl_beg, cursor); String prefix = m_context.buffer().string(compl_beg, cursor);