Don't make assumptions on textentry contents beyond the first '\0'.

This commit is contained in:
oliverschmidt 2006-08-30 22:24:12 +00:00
parent 62a48a4138
commit fba087810d
4 changed files with 20 additions and 8 deletions

View file

@ -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) {
if(c != 0) {
c = text[i + xscroll];
}
revers(i == w->widget.textentry.xpos - xscroll);
if(c == 0) {
cputc(' ');

View file

@ -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) {
if(c != 0) {
c = text[i + xscroll];
}
if(i == w->widget.textentry.xpos - xscroll) {
textcolor((unsigned char)(TERM_TEXTENTRYCOLOR + (focus ^ 0x01)));
revers(1);

View file

@ -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) {
if(c != 0) {
c = text[i + xscroll];
}
if(i == w->widget.textentry.xpos - xscroll) {
textcolor(VNC_OUT_TEXTENTRYCOLOR + (focus ^ 0x01));
revers(1);

View file

@ -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) {
if(c != 0) {
c = text[i + xscroll];
}
if(i == w->widget.textentry.xpos - xscroll) {
textcolor(VNC_OUT_TEXTENTRYCOLOR + (focus ^ 0x01));
revers(1);