TextEdit: If cursor pos reaches end, move to start, and the opposite

master
Ahmed Samy 10 years ago
parent d30ff220f6
commit c8b4566194

@ -498,16 +498,18 @@ void UITextEdit::wrapText()
void UITextEdit::moveCursorHorizontally(bool right) void UITextEdit::moveCursorHorizontally(bool right)
{ {
if(right) { if(right) {
if((uint)m_cursorPos+1 <= m_text.length()) { if((uint)m_cursorPos+1 <= m_text.length())
m_cursorPos++; m_cursorPos++;
blinkCursor(); else
} m_cursorPos = 0;
} else { } else {
if(m_cursorPos-1 >= 0) { if(m_cursorPos-1 >= 0)
m_cursorPos--; m_cursorPos--;
blinkCursor(); else
} m_cursorPos = m_text.length();
} }
blinkCursor();
update(true); update(true);
} }

Loading…
Cancel
Save