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.
This commit is contained in:
oliverschmidt 2006-10-06 21:14:28 +00:00
parent 21459934b6
commit e8ff2ba595
3 changed files with 9 additions and 14 deletions

View File

@ -29,7 +29,7 @@
* *
* This file is part of the Contiki desktop environment * 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) { switch(s.inputtype) {
case HTMLPARSER_INPUTTYPE_NONE: case HTMLPARSER_INPUTTYPE_NONE:
case HTMLPARSER_INPUTTYPE_TEXT: 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; s.inputvalue[s.inputvaluesize] = 0;
break; htmlparser_inputfield(s.inputvaluesize, s.inputvalue, s.inputname,
}
}
htmlparser_inputfield(s.inputvalue, s.inputname,
s.formname, s.formaction); s.formname, s.formaction);
break; break;
case HTMLPARSER_INPUTTYPE_SUBMIT: case HTMLPARSER_INPUTTYPE_SUBMIT:

View File

@ -29,7 +29,7 @@
* *
* This file is part of the Contiki desktop environment * 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__ #ifndef __HTMLPARSER_H__
@ -43,7 +43,8 @@ void htmlparser_submitbutton(char *value,
char *name, char *name,
char *formname, char *formname,
char *formaction); char *formaction);
void htmlparser_inputfield(char *value, void htmlparser_inputfield(unsigned char size,
char *value,
char *name, char *name,
char *formname, char *formname,
char *formaction); char *formaction);

View File

@ -29,7 +29,7 @@
* *
* This file is part of the Contiki desktop environment * 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 void
htmlparser_inputfield(char *text, char *name, htmlparser_inputfield(unsigned char size, char *text, char *name,
char *formname, char *formaction) char *formname, char *formaction)
{ {
register struct formattribs *form; 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) { if(form != NULL) {
strncpy(form->formaction, formaction, WWW_CONF_MAX_FORMACTIONLEN); strncpy(form->formaction, formaction, WWW_CONF_MAX_FORMACTIONLEN);
strncpy(form->formname, formname, WWW_CONF_MAX_FORMNAMELEN); strncpy(form->formname, formname, WWW_CONF_MAX_FORMNAMELEN);