From e8ff2ba595c7db5b2335f699f61814a98abc344c Mon Sep 17 00:00:00 2001 From: oliverschmidt Date: Fri, 6 Oct 2006 21:14:28 +0000 Subject: [PATCH] With the change to always position the cursor at the end of the exsisting text on entering the textentry field edit state it became necessary to avoid initializing textentry fields with blanks insteads of zeros. Unfortunately I overlooked the dynamically created textentry fields for web forms. Changing their behaviour was a little more complicated as the length of the existing text was used to determine the size of the textentry field. Now this size is passed explicitly. --- apps/webbrowser/htmlparser.c | 12 +++--------- apps/webbrowser/htmlparser.h | 5 +++-- apps/webbrowser/www.c | 6 +++--- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/apps/webbrowser/htmlparser.c b/apps/webbrowser/htmlparser.c index 377ab4910..2ad9bc978 100644 --- a/apps/webbrowser/htmlparser.c +++ b/apps/webbrowser/htmlparser.c @@ -29,7 +29,7 @@ * * This file is part of the Contiki desktop environment * - * $Id: htmlparser.c,v 1.2 2006/08/14 23:31:40 oliverschmidt Exp $ + * $Id: htmlparser.c,v 1.3 2006/10/06 21:14:28 oliverschmidt Exp $ * */ @@ -478,14 +478,8 @@ parse_tag(void) switch(s.inputtype) { case HTMLPARSER_INPUTTYPE_NONE: case HTMLPARSER_INPUTTYPE_TEXT: - for(i = 0; i < s.inputvaluesize; ++i) { - if(s.inputvalue[i] == 0) { - memset(&s.inputvalue[i], ISO_space, s.inputvaluesize - i); - s.inputvalue[s.inputvaluesize] = 0; - break; - } - } - htmlparser_inputfield(s.inputvalue, s.inputname, + s.inputvalue[s.inputvaluesize] = 0; + htmlparser_inputfield(s.inputvaluesize, s.inputvalue, s.inputname, s.formname, s.formaction); break; case HTMLPARSER_INPUTTYPE_SUBMIT: diff --git a/apps/webbrowser/htmlparser.h b/apps/webbrowser/htmlparser.h index 37a7536bb..d5047aedb 100644 --- a/apps/webbrowser/htmlparser.h +++ b/apps/webbrowser/htmlparser.h @@ -29,7 +29,7 @@ * * This file is part of the Contiki desktop environment * - * $Id: htmlparser.h,v 1.1 2006/06/17 22:41:13 adamdunkels Exp $ + * $Id: htmlparser.h,v 1.2 2006/10/06 21:14:28 oliverschmidt Exp $ * */ #ifndef __HTMLPARSER_H__ @@ -43,7 +43,8 @@ void htmlparser_submitbutton(char *value, char *name, char *formname, char *formaction); -void htmlparser_inputfield(char *value, +void htmlparser_inputfield(unsigned char size, + char *value, char *name, char *formname, char *formaction); diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index 0d3e38b82..90ee62832 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -29,7 +29,7 @@ * * This file is part of the Contiki desktop environment * - * $Id: www.c,v 1.2 2006/08/14 23:33:26 oliverschmidt Exp $ + * $Id: www.c,v 1.3 2006/10/06 21:14:28 oliverschmidt Exp $ * */ @@ -866,12 +866,12 @@ htmlparser_submitbutton(char *text, char *name, } /*-----------------------------------------------------------------------------------*/ void -htmlparser_inputfield(char *text, char *name, +htmlparser_inputfield(unsigned char size, char *text, char *name, char *formname, char *formaction) { register struct formattribs *form; - form = add_pagewidget(text, (unsigned char)strlen(text), CTK_WIDGET_TEXTENTRY, 1); + form = add_pagewidget(text, size, CTK_WIDGET_TEXTENTRY, 1); if(form != NULL) { strncpy(form->formaction, formaction, WWW_CONF_MAX_FORMACTIONLEN); strncpy(form->formname, formname, WWW_CONF_MAX_FORMNAMELEN);