From 4210a177531d9b88330aa43ec44c5e8c2ac8d73b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 11 Oct 2012 14:22:08 +0200 Subject: [PATCH] Client: never call substr(CharCount, String::npos); --- src/client.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client.cc b/src/client.cc index 27c85f19..71dbafcc 100644 --- a/src/client.cc +++ b/src/client.cc @@ -224,7 +224,7 @@ public: if (m_cursor_pos != 0) { m_result = m_result.substr(0, m_cursor_pos - 1) - + m_result.substr(m_cursor_pos, String::npos); + + m_result.substr(m_cursor_pos); --m_cursor_pos; } @@ -239,7 +239,7 @@ public: context.ui().menu_hide(); m_current_completion = -1; m_result = m_result.substr(0, m_cursor_pos) + reg - + m_result.substr(m_cursor_pos, String::npos); + + m_result.substr(m_cursor_pos); m_cursor_pos += reg.char_length(); } else if (key == Key(Key::Modifiers::Control, 'i') or // tab completion @@ -283,7 +283,7 @@ public: std::string keystr; auto inserter = back_inserter(keystr); utf8::dump(inserter, key.key); - m_result = m_result.substr(0, m_cursor_pos) + keystr + m_result.substr(m_cursor_pos, String::npos); + m_result = m_result.substr(0, m_cursor_pos) + keystr + m_result.substr(m_cursor_pos); ++m_cursor_pos; } context.ui().print_status(m_prompt + m_result, m_prompt.char_length() + m_cursor_pos);