From 27d50151320e2bc23aa0f7629ddf042543eb909b Mon Sep 17 00:00:00 2001 From: Jonas Suhr Christensen Date: Fri, 5 Dec 2014 21:56:10 +0100 Subject: Marker going further than end of text. --- plugingui/lineedit.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugingui/lineedit.cc b/plugingui/lineedit.cc index 46354bb..b8f7ca2 100644 --- a/plugingui/lineedit.cc +++ b/plugingui/lineedit.cc @@ -95,7 +95,6 @@ void GUI::LineEdit::buttonEvent(ButtonEvent *e) if(e->direction == 1) { for(int i = 0; i < (int)_visibletext.length(); i++) { if(e->x < (int)(font.textWidth(_visibletext.substr(0, i)) + BORDER)) { - printf("i, Offset: %d, %d\n", i, offsetpos); pos = i + offsetpos; break; } @@ -128,7 +127,8 @@ void GUI::LineEdit::keyEvent(GUI::KeyEvent *e) } else if(e->keycode == GUI::KeyEvent::KEY_RIGHT) { if(pos < _text.length()) pos++; - if(offsetpos + _visibletext.length() <= pos) walkstate = WALK_RIGHT; + if(offsetpos + _visibletext.length() <= pos && + pos < _text.length()) walkstate = WALK_RIGHT; // else walkstate = NOOP; } else if(e->keycode == GUI::KeyEvent::KEY_DELETE) { -- cgit v1.2.3