shithub: riscv

Download patch

ref: 5b35bbce54fda77e65f0264ea93776e154cada18
parent: 67541baee8f611e0515021fd6034a2e9bfada6ab
author: cinap_lenrek <[email protected]>
date: Sat Jul 7 15:31:41 EDT 2012

mothra: ignore size attribute for select tag

--- a/sys/src/cmd/mothra/forms.c
+++ b/sys/src/cmd/mothra/forms.c
@@ -120,7 +120,6 @@
 
 		g->form->next = g->dst->form;
 		g->dst->form = g->form;
-
 		break;
 	case Tag_input:
 	case Tag_button:
@@ -211,14 +210,9 @@
 		}
 		else
 			f->name=strdup(s);
-		s=pl_getattr(g->attr, "size");
-		if(s==0) f->size=4;
-		else{
-			f->size=atoi(s);
-			if(f->size<=0) f->size=1;
-		}
 		f->multiple=pl_hasattr(g->attr, "multiple");
 		f->type=SELECT;
+		f->size=0;
 		f->options=0;
 		g->text=g->token;
 		g->tp=g->text;
@@ -227,6 +221,8 @@
 	case Tag_option:
 		if(g->form==0) goto BadTag;
 		if((f=g->form->efields)==0) goto BadTag;
+		if(f->size<8)
+			f->size++;
 		o=emallocz(sizeof(Option), 1);
 		for(op=&f->options;*op;op=&(*op)->next);
 		*op=o;
@@ -370,6 +366,8 @@
 		f->p=plbutton(0, 0, f->value[0]?f->value:"file", h_fileinput);
 		break;
 	case SELECT:
+		if(f->size <= 0)
+			f->size=1;
 		f->pulldown=plgroup(0,0);
 		scrl=plscrollbar(f->pulldown, PACKW|FILLY);
 		win=pllist(f->pulldown, PACKN, nullgen, f->size, h_select);
@@ -384,8 +382,7 @@
 		f->p=plframe(0,0);
 		pllabel(f->p, PACKN|FILLX, f->name);
 		scrl=plscrollbar(f->p, PACKW|FILLY);
-		f->textwin=pledit(f->p, EXPAND, Pt(f->cols*chrwidth, f->rows*font->height),
-			0, 0, 0);
+		f->textwin=pledit(f->p, EXPAND, Pt(f->cols*chrwidth, f->rows*font->height), 0, 0, 0);
 		f->textwin->userp=f;
 		plscroll(f->textwin, 0, scrl);
 		break;