diff --git a/editline/editline.go b/editline/editline.go index 0981dc2..6729a79 100644 --- a/editline/editline.go +++ b/editline/editline.go @@ -649,8 +649,12 @@ func (m *Model) Debug() string { } // SetSize changes the size of the editor. +// NB: if one of the dimensions is zero, the call is a no-op. // NB: it only takes effect at the first next event processed. func (m *Model) SetSize(width, height int) { + if width == 0 || height == 0 { + return + } m.hasNewSize = true m.newWidth = width m.newHeight = height diff --git a/editline/testdata/bad_resize b/editline/testdata/bad_resize new file mode 100644 index 0000000..84ac1e8 --- /dev/null +++ b/editline/testdata/bad_resize @@ -0,0 +1,10 @@ +run +reset +resize 40 25 +resize 0 0 +---- +TEA WINDOW SIZE: {40 25} +TEA WINDOW SIZE: {0 0} +-- view: +>   ␤ +M-? toggle key help • C-d erase/stop🛇 \ No newline at end of file