From 9c78f02903a3d2e0bb7fa94c5393aaba12d3e599 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 19 Mar 2013 14:15:42 +0100 Subject: [PATCH] BufferCompleter: fix backward looping in completion candidates --- src/input_handler.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/input_handler.cc b/src/input_handler.cc index 658b0d56..037dbb40 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -525,7 +525,9 @@ public: return; m_context.buffer().erase(m_position, m_position + m_completions[m_current_completion].length()); - m_current_completion = (m_current_completion + offset) % m_completions.size(); + m_current_completion = (m_current_completion + offset) % (int)m_completions.size(); + if (m_current_completion < 0) + m_current_completion += m_completions.size(); m_context.buffer().insert(m_position, m_completions[m_current_completion]); m_context.ui().menu_select(m_current_completion); }