From bc81281c84ab981fec920d4861f561a3226ae48b Mon Sep 17 00:00:00 2001 From: makeworld Date: Mon, 25 Apr 2022 20:34:04 -0400 Subject: [PATCH] Possibly improve resize logic perf --- display/display.go | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/display/display.go b/display/display.go index c7cd6f6..4c9ea3b 100644 --- a/display/display.go +++ b/display/display.go @@ -82,23 +82,18 @@ func Init(version, commit, builtBy string) { termH = height // Make sure the current tab content is reformatted when the terminal size changes - go func(t *tab) { - reformatMu.Lock() // Only allow one reformat job at a time - for i := range tabs { - // Overwrite all tabs with a new, differently sized, left margin - browser.AddTab( - strconv.Itoa(i), - tabs[i].label(), - makeContentLayout(tabs[i].view, leftMargin()), - ) - if tabs[i] == t { - // Reformat page ASAP, in the middle of loop - reformatPageAndSetView(t, t.page) - } + for i := range tabs { + // Overwrite all tabs with a new, differently sized, left margin + browser.AddTab( + strconv.Itoa(i), + tabs[i].label(), + makeContentLayout(tabs[i].view, leftMargin()), + ) + if tabs[i] == tabs[curTab] { + // Reformat page ASAP, in the middle of loop + reformatPageAndSetView(tabs[curTab], tabs[curTab].page) } - App.Draw() - reformatMu.Unlock() - }(tabs[curTab]) + } }) panels.AddPanel(PanelBrowser, browser, true, true)