1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-06-19 19:25:24 +00:00

🎨 Rename reformat func

This commit is contained in:
makeworld 2020-07-04 11:32:11 -04:00
parent 4382eaf421
commit 518c35453a
3 changed files with 6 additions and 6 deletions

View File

@ -1,8 +1,8 @@
# Notes
- Simplify into one struct
- All the maps and stuff could be replaced with a `tab` struct
- And then just one single map of tab number to `tab`
- All the maps and stuff could be replaced with a `Tab` struct
- And then just one single map of tab number to `Tab`
- URL for each tab should not be stored as a string - in the current code there's lots of reparsing the URL
## Upstream Bugs

View File

@ -89,7 +89,7 @@ var App = cview.NewApplication().
reformatMuts[tab].Lock() // Only one reformat job per tab
defer reformatMuts[tab].Unlock()
// Use the current tab, but don't affect other tabs if the user switches tabs
reformatAndDisplayPage(tab, tabMap[tab])
reformatPageAndSetView(tab, tabMap[tab])
}(curTab)
})
@ -517,7 +517,7 @@ func SwitchTab(tab int) {
}
curTab = tab % NumTabs()
reformatAndDisplayPage(curTab, tabMap[curTab])
reformatPageAndSetView(curTab, tabMap[curTab])
tabPages.SwitchToPage(strconv.Itoa(curTab))
tabRow.Highlight(strconv.Itoa(curTab)).ScrollToHighlight()

View File

@ -183,9 +183,9 @@ func reformatPage(p *structs.Page) {
p.Width = termW
}
// reformatAndDisplayPage is for reformatting a page that is already being displayed.
// reformatPageAndSetView is for reformatting a page that is already being displayed.
// setPage should be used when a page is being loaded for the first time.
func reformatAndDisplayPage(tab int, p *structs.Page) {
func reformatPageAndSetView(tab int, p *structs.Page) {
saveScroll()
reformatPage(p)
tabViews[tab].SetText(p.Content)