summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2011-01-24 09:48:00 +0000
committerbernard.xiong <[email protected]>2011-01-24 09:48:00 +0000
commit2aeee86c5f4db5a4c92ecfa3b4389567eb8f2349 (patch)
tree676f976ebc9f1bcd47d92cd3f7eb41526cdb2254
parent1f46f9da43ae758db6f246fe5e02aa3c18262cbe (diff)
fix backspace issue.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1257 bbd45198-f89e-11dd-88c7-29a3b14d5316
-rw-r--r--components/rtgui/widgets/textbox.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/components/rtgui/widgets/textbox.c b/components/rtgui/widgets/textbox.c
index 6a7ca0e7a2..37e7f2c301 100644
--- a/components/rtgui/widgets/textbox.c
+++ b/components/rtgui/widgets/textbox.c
@@ -10,6 +10,7 @@
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
+ * 2011-01-224 Bernard fix backspace issue.
*/
#include <rtgui/dc.h>
#include <rtgui/rtgui_theme.h>
@@ -166,7 +167,7 @@ static void rtgui_textbox_onkey(struct rtgui_textbox* box, struct rtgui_event_kb
}
else if (event->key == RTGUIK_BACKSPACE)
{
- if (box->position == length - 1)
+ if ((box->position == length - 1) && length != 1)
{
box->text[box->position] = '\0';
box->position --;