From c8b4566194b56125af3593930be3a704b9193c92 Mon Sep 17 00:00:00 2001 From: Ahmed Samy Date: Mon, 10 Feb 2014 08:05:45 +0200 Subject: [PATCH] TextEdit: If cursor pos reaches end, move to start, and the opposite --- src/framework/ui/uitextedit.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/framework/ui/uitextedit.cpp b/src/framework/ui/uitextedit.cpp index 999a4e5e..6f14c7fd 100644 --- a/src/framework/ui/uitextedit.cpp +++ b/src/framework/ui/uitextedit.cpp @@ -498,16 +498,18 @@ void UITextEdit::wrapText() void UITextEdit::moveCursorHorizontally(bool right) { if(right) { - if((uint)m_cursorPos+1 <= m_text.length()) { + if((uint)m_cursorPos+1 <= m_text.length()) m_cursorPos++; - blinkCursor(); - } + else + m_cursorPos = 0; } else { - if(m_cursorPos-1 >= 0) { + if(m_cursorPos-1 >= 0) m_cursorPos--; - blinkCursor(); - } + else + m_cursorPos = m_text.length(); } + + blinkCursor(); update(true); }