From fba087810d89379ea3b478f319348751438a86b2 Mon Sep 17 00:00:00 2001 From: oliverschmidt Date: Wed, 30 Aug 2006 22:24:12 +0000 Subject: [PATCH] Don't make assumptions on textentry contents beyond the first '\0'. --- core/ctk/ctk-conio.c | 7 +++++-- core/ctk/ctk-term.c | 7 +++++-- core/ctk/ctk-vncserver-service.c | 7 +++++-- core/ctk/ctk-vncserver.c | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/core/ctk/ctk-conio.c b/core/ctk/ctk-conio.c index e3408b3d4..783366102 100644 --- a/core/ctk/ctk-conio.c +++ b/core/ctk/ctk-conio.c @@ -29,7 +29,7 @@ * * This file is part of the "ctk" console GUI toolkit for cc65 * - * $Id: ctk-conio.c,v 1.1 2006/06/17 22:41:15 adamdunkels Exp $ + * $Id: ctk-conio.c,v 1.2 2006/08/30 22:24:12 oliverschmidt Exp $ * */ @@ -162,8 +162,11 @@ draw_widget(struct ctk_widget *w, w->widget.textentry.ypos == j) { revers(0); cputcxy(xpos, ypos, '>'); + c = 1; for(i = 0; i < w->w; ++i) { - c = text[i + xscroll]; + if(c != 0) { + c = text[i + xscroll]; + } revers(i == w->widget.textentry.xpos - xscroll); if(c == 0) { cputc(' '); diff --git a/core/ctk/ctk-term.c b/core/ctk/ctk-term.c index 786e095da..354cdf822 100644 --- a/core/ctk/ctk-term.c +++ b/core/ctk/ctk-term.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: ctk-term.c,v 1.1 2006/06/17 22:41:16 adamdunkels Exp $ + * @(#)$Id: ctk-term.c,v 1.2 2006/08/30 22:24:12 oliverschmidt Exp $ */ #include "ctk/ctk.h" #include "ctk-draw.h" @@ -506,8 +506,11 @@ draw_widget(struct ctk_widget *w, w->widget.textentry.ypos == j) { revers(0); cputcxy(xpos, ypos, '>'); + c = 1; for(i = 0; i < w->w; ++i) { - c = text[i + xscroll]; + if(c != 0) { + c = text[i + xscroll]; + } if(i == w->widget.textentry.xpos - xscroll) { textcolor((unsigned char)(TERM_TEXTENTRYCOLOR + (focus ^ 0x01))); revers(1); diff --git a/core/ctk/ctk-vncserver-service.c b/core/ctk/ctk-vncserver-service.c index 280f05838..67e7775ba 100644 --- a/core/ctk/ctk-vncserver-service.c +++ b/core/ctk/ctk-vncserver-service.c @@ -41,7 +41,7 @@ * * This file is part of the "ctk" console GUI toolkit for cc65 * - * $Id: ctk-vncserver-service.c,v 1.1 2006/06/17 22:41:16 adamdunkels Exp $ + * $Id: ctk-vncserver-service.c,v 1.2 2006/08/30 22:24:12 oliverschmidt Exp $ * */ @@ -438,8 +438,11 @@ draw_widget(register struct ctk_widget *w, w->widget.textentry.ypos == j) { revers(0); cputcxy(xpos, ypos, '>'); + c = 1; for(i = 0; i < w->w; ++i) { - c = text[i + xscroll]; + if(c != 0) { + c = text[i + xscroll]; + } if(i == w->widget.textentry.xpos - xscroll) { textcolor(VNC_OUT_TEXTENTRYCOLOR + (focus ^ 0x01)); revers(1); diff --git a/core/ctk/ctk-vncserver.c b/core/ctk/ctk-vncserver.c index a3e3010d3..6e1330a62 100644 --- a/core/ctk/ctk-vncserver.c +++ b/core/ctk/ctk-vncserver.c @@ -41,7 +41,7 @@ * * This file is part of the "ctk" console GUI toolkit for cc65 * - * $Id: ctk-vncserver.c,v 1.1 2006/06/17 22:41:16 adamdunkels Exp $ + * $Id: ctk-vncserver.c,v 1.2 2006/08/30 22:24:12 oliverschmidt Exp $ * */ @@ -421,8 +421,11 @@ draw_widget(struct ctk_widget *w, w->widget.textentry.ypos == j) { revers(0); cputcxy(xpos, ypos, '>'); + c = 1; for(i = 0; i < w->w; ++i) { - c = text[i + xscroll]; + if(c != 0) { + c = text[i + xscroll]; + } if(i == w->widget.textentry.xpos - xscroll) { textcolor(VNC_OUT_TEXTENTRYCOLOR + (focus ^ 0x01)); revers(1);