Move cursor always to the end of a text entry widget on entering the edit state instead of remembering the cursor position from the last edit because
- this is plainly the expected behaviour
- in almost all cases the user either wants to append text or delete text (and as Contiki only supports a <backspace> but no <delete> action this means positioning the cursor to the end as well)
diff --git a/contiki/ctk/ctk.c b/contiki/ctk/ctk.c
index 7901536..1323c29 100644
--- a/contiki/ctk/ctk.c
+++ b/contiki/ctk/ctk.c
@@ -43,7 +43,7 @@
  *
  * This file is part of the Contiki operating system.
  *
- * $Id: ctk.c,v 1.45 2005/03/15 15:51:17 oliverschmidt Exp $
+ * $Id: ctk.c,v 1.46 2005/04/24 23:01:20 oliverschmidt Exp $
  *
  */
 
@@ -1180,8 +1180,6 @@
 static unsigned char CC_FASTCALL 
 activate(CC_REGISTER_ARG struct ctk_widget *w)
 {
-  static unsigned char len;
-  
   if(w->type == CTK_WIDGET_BUTTON) {
     if(w == (struct ctk_widget *)&windows->closebutton) {
 #if CTK_CONF_WINDOWCLOSE
@@ -1210,9 +1208,9 @@
   } else if(w->type == CTK_WIDGET_TEXTENTRY) {
     if(w->widget.textentry.state == CTK_TEXTENTRY_NORMAL) {      
       w->widget.textentry.state = CTK_TEXTENTRY_EDIT;
-      len = strlen(w->widget.textentry.text);
-      if(w->widget.textentry.xpos > len) {
-	w->widget.textentry.xpos = len;
+      w->widget.textentry.xpos = strlen(w->widget.textentry.text);
+      if(w->widget.textentry.xpos == w->widget.textentry.len) {
+	--w->widget.textentry.xpos;
       }
     } else if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT) {
       w->widget.textentry.state = CTK_TEXTENTRY_NORMAL;