summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2014-11-04 10:58:43 +0100
committerJonas Suhr Christensen <jsc@umbraculum.org>2014-11-04 10:58:43 +0100
commit3a54a227a0217cc1c1b18e0789b5c3ac489254a9 (patch)
treee65efdcbb9f275a5964278de97bcc5b0ea460a24
parent29ec8552826f64bfa8cad01a433306886328c522 (diff)
Fixed: LineEdit, scroll when in end on line and arrow right typed.
-rw-r--r--plugingui/lineedit.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugingui/lineedit.cc b/plugingui/lineedit.cc
index 46354bb..bd827d3 100644
--- a/plugingui/lineedit.cc
+++ b/plugingui/lineedit.cc
@@ -91,7 +91,6 @@ void GUI::LineEdit::buttonEvent(ButtonEvent *e)
{
if(readOnly()) return;
-
if(e->direction == 1) {
for(int i = 0; i < (int)_visibletext.length(); i++) {
if(e->x < (int)(font.textWidth(_visibletext.substr(0, i)) + BORDER)) {
@@ -184,12 +183,16 @@ void GUI::LineEdit::repaintEvent(GUI::RepaintEvent *e)
else if(walkstate == WALK_RIGHT) {
int d = (offsetpos < _text.length()) ? 1 : 0;
_visibletext = _text.substr(offsetpos + d);
- offsetpos = offsetpos + d;
+
+ if(pos < _text.length()) offsetpos = offsetpos + d;
}
else {
_visibletext = _text;
offsetpos = 0;
}
+
+// if(offsetpos > _text.length()) offsetpos = _text.length();
+
while(true) {
int textwidth = font.textWidth(_visibletext);
if(textwidth > w - BORDER - 4 + 3) {
@@ -217,6 +220,10 @@ void GUI::LineEdit::repaintEvent(GUI::RepaintEvent *e)
}
}
+ printf("OFFSETPOS: %d\n", offsetpos);
+ printf("POS: %d\n", pos);
+ printf("TEXTLENGTH: %d\n", _text.length());
+
walkstate = NOOP;
p.drawText(BORDER - 4 + 3, height()/2+5 + 1 + 1 + 1, font, _visibletext);