Every line in a multiline textentry widget is supposed to have an addtional zero termination so take that into account when computing line offsets.
diff --git a/contiki/lib/ctk-textentry-multiline.c b/contiki/lib/ctk-textentry-multiline.c
index 50f0520..26ae0de 100644
--- a/contiki/lib/ctk-textentry-multiline.c
+++ b/contiki/lib/ctk-textentry-multiline.c
@@ -29,7 +29,7 @@
*
* This file is part of the Contiki operating system.
*
- * $Id: ctk-textentry-multiline.c,v 1.2 2005/05/04 23:07:17 oliverschmidt Exp $
+ * $Id: ctk-textentry-multiline.c,v 1.3 2005/05/05 20:55:50 oliverschmidt Exp $
*
*/
@@ -48,7 +48,7 @@
switch(c) {
case 0:
- t->xpos = strlen(&t->text[t->ypos * t->len]);
+ t->xpos = strlen(&t->text[t->ypos * (t->len + 1)]);
if(t->xpos == t->len) {
--t->xpos;
}
@@ -64,7 +64,7 @@
case CH_CURS_DOWN:
if(t->ypos == t->h - 1) {
- t->xpos = strlen(&t->text[t->ypos * t->len]);
+ t->xpos = strlen(&t->text[t->ypos * (t->len + 1)]);
if(t->xpos == t->len) {
--t->xpos;
}
@@ -85,7 +85,7 @@
return 0;
}
- len = strlen(&t->text[t->ypos * t->len]);
+ len = strlen(&t->text[t->ypos * (t->len + 1)]);
if(t->xpos > len) {
t->xpos = len;
}