diff --git a/container/container_test.go b/container/container_test.go index d111306..962ae31 100644 --- a/container/container_test.go +++ b/container/container_test.go @@ -277,6 +277,7 @@ func TestDraw(t *testing.T) { return ft }, }, + // TODO(mum4k): Tests where widget removes children and vice versa. } for _, tc := range tests { diff --git a/terminalapi/event.go b/terminalapi/event.go index 5017f9f..5b716b4 100644 --- a/terminalapi/event.go +++ b/terminalapi/event.go @@ -1,6 +1,7 @@ package terminalapi import ( + "errors" "image" "github.com/mum4k/termdash/keyboard" @@ -46,3 +47,16 @@ type Mouse struct { } func (*Mouse) isEvent() {} + +// Error is an event indicating an error while processing input. +type Error string + +func (*Error) isEvent() {} + +// Error returns the error that occurred. +func (e *Error) Error() error { + if e == nil || *e == "" { + return nil + } + return errors.New(e) +}