summaryrefslogtreecommitdiff
path: root/plugingui/lineedit.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2011-11-01 13:51:52 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2011-11-01 13:51:52 +0100
commitcb2263213fea95d144f939ff4d69ae1776f542a5 (patch)
tree19c94eb3c9dcba60cf9302577f1734dde52fed91 /plugingui/lineedit.cc
parent6cc555aedd6362c5c195d33a71678f344613acc4 (diff)
Make new characters correctly appear when pos is not end=of-string.
Diffstat (limited to 'plugingui/lineedit.cc')
-rw-r--r--plugingui/lineedit.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugingui/lineedit.cc b/plugingui/lineedit.cc
index 510c551..e2a63d9 100644
--- a/plugingui/lineedit.cc
+++ b/plugingui/lineedit.cc
@@ -31,6 +31,8 @@
#include "painter.h"
#include "globalcontext.h"
+using namespace DGGUI;
+
#define BORDER 10
LineEdit::LineEdit(GlobalContext *gctx, Widget *parent)
@@ -77,7 +79,9 @@ void LineEdit::key(KeyEvent *e)
}
} else if(e->keycode >= 10 && e->keycode <= 61) {
- _text += e->text;
+ std::string pre = _text.substr(0, pos);
+ std::string post = _text.substr(pos, std::string::npos);
+ _text = pre + e->text + post;
pos++;
}