summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 --;