From 05c732782558df04e47a672c727b89dbc1d2360f Mon Sep 17 00:00:00 2001 From: delthas Date: Fri, 22 Jul 2022 18:06:07 +0200 Subject: Fix crashing when shrinking the text to a zero width Thanks steamyalt for the bug report. Fixes: https://todo.sr.ht/~taiite/senpai/86 --- ui/ui.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/ui.go b/ui/ui.go index 9e4af88..5533633 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -400,6 +400,9 @@ func (ui *UI) InputBackSearch() { func (ui *UI) Resize() { w, h := ui.screen.Size() innerWidth := w - 9 - ui.channelWidth - ui.config.NickColWidth - ui.memberWidth + if innerWidth <= 0 { + innerWidth = 1 // will break display somewhat, but this is an edge case + } ui.e.Resize(innerWidth) if ui.channelWidth == 0 { ui.bs.ResizeTimeline(innerWidth, h-3) -- cgit v1.2.3