summaryrefslogtreecommitdiff
path: root/plugingui/lineedit.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-10-31 14:44:23 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-10-31 14:44:23 +0100
commit5d76d943eca9734f7df2dc351871815385c571b3 (patch)
tree6f395e870283b43702e75e320dd53ed316e22db9 /plugingui/lineedit.cc
parentbc931baa7a31857b971b9ac6543b2af20cdd1bf1 (diff)
Font refactoring. Some rendering optimizations on ScrollBar, LineEdit and ListBoxBasic.
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())
{