Fix paint subscription

Must bind the concrete Painter struct to the paint subscription (not the
composed BaseView). Solved by creating an anonymous function that binds
to the Painter argument.
diff --git a/base_view.go b/base_view.go index 7495113..204b435 100644
--- a/base_view.go +++ b/base_view.go @@ -3,7 +3,7 @@ package tuikit
import "github.com/nsf/tulib"

 type BaseView struct {
-	paintSubscription func(Painter) +	paintSubscription func()
        childrenRect      map[Painter]tulib.Rect childrenNeedPaint
        map[Painter]bool } @@ -17,7 +17,7 @@ func NewBaseView()
        *BaseView {

 func (v *BaseView) NeedPaint() { if v.paintSubscription != nil {
-		v.paintSubscription(v) + v.paintSubscription() } }

@@ -29,7 +29,7 @@ func (v *BaseView) AttachChild(child Painter, rect
tulib.Rect) { } }

-	child.SetPaintSubscription(v.ChildNeedsPaint) +
        child.SetPaintSubscription(func() { v.ChildNeedsPaint(child) })
        v.childrenRect[child] = rect v.childrenNeedPaint[child] = true }
        @@ -58,12 +58,12 @@ func (v *BaseView) PaintTo(buffer
        *tulib.Buffer, rect tulib.Rect) error { if err :=
        c.PaintTo(buffer, r.Intersection(rect)); err != nil { return err
        }
-		v.childrenNeedPaint[c] = false +
                delete(v.childrenNeedPaint, c) }

        return nil }

-func (v *BaseView) SetPaintSubscription(cb func(Painter)) { +func (v
*BaseView) SetPaintSubscription(cb func()) { v.paintSubscription = cb }
diff --git a/text_widget.go b/text_widget.go
index 49782c4..586b57a 100644
--- a/text_widget.go
+++ b/text_widget.go
@@ -311,8 +311,12 @@ func (v *TextWidget) cancelInput() {
 }

 func (v *TextWidget) PaintTo(buffer *tulib.Buffer, rect tulib.Rect) error {
-	buffer.Fill(rect, termbox.Cell{Ch: 'b'})
-	return nil
+	log.Debug.Printf("Text: %v (len: %v)", string(v.text), len(v.text))
+	log.Debug.Printf("Text: %v", v.text)
+
+	return v.TextView.PaintTo(buffer, rect)
+	//	v.Cursor = NewPoint(v.cursorPos, 0)
+	//	return nil
 }

 //func (v *TextWidget) Paint() {
diff --git a/tuikit.go b/tuikit.go
index ad89b86..35c1d8f 100644
--- a/tuikit.go
+++ b/tuikit.go
@@ -11,7 +11,7 @@ import (

 type Painter interface {
 	PaintTo(buffer *tulib.Buffer, rect tulib.Rect) error
-	SetPaintSubscription(cb func(Painter))
+	SetPaintSubscription(cb func())
 }

 type EventHandler interface {