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

This commit is contained in:
Ahmed Samy 2014-02-10 08:05:45 +02:00
parent d30ff220f6
commit c8b4566194
1 changed files with 8 additions and 6 deletions

View File

@ -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--;
else
m_cursorPos = m_text.length();
}
blinkCursor(); blinkCursor();
}
}
update(true); update(true);
} }