@@ -42,9 +42,9 @@ func (c *Context) textFieldRaw(buf *string, id controlID, opt option) bool {
4242 return c .control (id , opt | optionHoldFocus , func (bounds image.Rectangle , wasFocused bool ) bool {
4343 var res bool
4444
45+ f := c .textInputTextField (id )
4546 if c .focus == id {
4647 // handle text input
47- f := c .textInputTextField (id )
4848 f .Focus ()
4949 x := bounds .Min .X + c .style ().padding + textWidth (* buf )
5050 y := bounds .Min .Y + lineHeight ()
@@ -53,8 +53,8 @@ func (c *Context) textFieldRaw(buf *string, id controlID, opt option) bool {
5353 fmt .Fprintln (os .Stderr , err )
5454 return false
5555 }
56- if * buf != f .TextForRendering () {
57- * buf = f .TextForRendering ()
56+ if * buf != f .Text () {
57+ * buf = f .Text ()
5858 }
5959
6060 if ! handled {
@@ -68,8 +68,7 @@ func (c *Context) textFieldRaw(buf *string, id controlID, opt option) bool {
6868 }
6969 }
7070 } else {
71- f := c .textInputTextField (id )
72- if * buf != f .TextForRendering () {
71+ if * buf != f .Text () {
7372 f .SetTextAndSelection (* buf , len (* buf ), len (* buf ))
7473 }
7574 if wasFocused {
@@ -87,7 +86,7 @@ func (c *Context) textFieldRaw(buf *string, id controlID, opt option) bool {
8786 textx := bounds .Min .X + min (ofx , c .style ().padding )
8887 texty := bounds .Min .Y + (bounds .Dy ()- texth )/ 2
8988 c .pushClipRect (bounds )
90- c .drawText (* buf , image .Pt (textx , texty ), color )
89+ c .drawText (f . TextForRendering () , image .Pt (textx , texty ), color )
9190 c .drawRect (image .Rect (textx + textw , texty , textx + textw + 1 , texty + texth ), color )
9291 c .popClipRect ()
9392 } else {
0 commit comments