summaryrefslogtreecommitdiff
path: root/plugingui/lineedit.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/lineedit.cc')
-rw-r--r--plugingui/lineedit.cc32
1 files changed, 19 insertions, 13 deletions
diff --git a/plugingui/lineedit.cc b/plugingui/lineedit.cc
index 9c2420c..12969ba 100644
--- a/plugingui/lineedit.cc
+++ b/plugingui/lineedit.cc
@@ -124,16 +124,33 @@ void LineEdit::keyEvent(KeyEvent *keyEvent)
{
switch(keyEvent->keycode) {
case KeyEvent::KeyLeft:
- if(pos)
+ if(pos == 0)
{
- pos--;
+ return;
}
+
+ pos--;
+
if(offsetPos >= pos)
{
walkstate = WalkLeft;
}
break;
+ case KeyEvent::KeyRight:
+ if(pos == _text.length())
+ {
+ return;
+ }
+
+ pos++;
+
+ if((pos < _text.length()) && ((offsetPos + visibleText.length()) <= pos))
+ {
+ walkstate = WalkRight;
+ }
+ break;
+
case KeyEvent::KeyHome:
pos = 0;
visibleText = _text;
@@ -146,17 +163,6 @@ void LineEdit::keyEvent(KeyEvent *keyEvent)
offsetPos = 0;
break;
- case KeyEvent::KeyRight:
- if(pos < _text.length())
- {
- pos++;
- }
- if((pos < _text.length()) && ((offsetPos + visibleText.length()) <= pos))
- {
- walkstate = WalkRight;
- }
- break;
-
case KeyEvent::KeyDelete:
if(pos < _text.length())
{