diff --git a/tests/screen_test.go b/tests/screen_test.go index 6c8ec77..45820da 100644 --- a/tests/screen_test.go +++ b/tests/screen_test.go @@ -62,8 +62,8 @@ func TestScrollView(t *testing.T) { } screen.MouseClicked = func(event *tui.MouseEvent) (consumed bool) { - textViews[0].(*views.TextView).Text = fmt.Sprintf("mouse position: %d | %d", event.X, event.Y) - textViews[1].(*views.TextView).Text = fmt.Sprintf("mouse button: %d", event.Button) + //textViews[0].(*views.TextView).Text = fmt.Sprintf("mouse position: %d | %d", event.X, event.Y) + //textViews[1].(*views.TextView).Text = fmt.Sprintf("mouse button: %d", event.Button) if event.Button == tui.MouseWheelUp { scrollView.Scroll(-1, 0) diff --git a/views/layout_flow.go b/views/layout_flow.go index 7058f13..0751821 100644 --- a/views/layout_flow.go +++ b/views/layout_flow.go @@ -24,7 +24,7 @@ func NewFlowLayout(orientation tui.Orientation) *FlowLayout { } func (g *FlowLayout) Views() []tui.View { - return g.views[:] + return g.views } func (g *FlowLayout) AppendViews(v ...tui.View) { @@ -49,7 +49,11 @@ func (g *FlowLayout) removeView(v tui.View) { } func (g *FlowLayout) RemoveViews(v ...tui.View) { + views := make([]tui.View, 0, len(v)) for _, view := range v { + views = append(views, view) + } + for _, view := range views { g.removeView(view) } }