mirror of
https://github.com/makew0rld/amfora.git
synced 2025-01-03 14:56:27 -05:00
🎨 Rename reformat func
This commit is contained in:
parent
4382eaf421
commit
518c35453a
4
NOTES.md
4
NOTES.md
@ -1,8 +1,8 @@
|
|||||||
# Notes
|
# Notes
|
||||||
|
|
||||||
- Simplify into one struct
|
- Simplify into one struct
|
||||||
- All the maps and stuff could be replaced with a `tab` struct
|
- All the maps and stuff could be replaced with a `Tab` struct
|
||||||
- And then just one single map of tab number to `tab`
|
- 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
|
- URL for each tab should not be stored as a string - in the current code there's lots of reparsing the URL
|
||||||
|
|
||||||
## Upstream Bugs
|
## Upstream Bugs
|
||||||
|
@ -89,7 +89,7 @@ var App = cview.NewApplication().
|
|||||||
reformatMuts[tab].Lock() // Only one reformat job per tab
|
reformatMuts[tab].Lock() // Only one reformat job per tab
|
||||||
defer reformatMuts[tab].Unlock()
|
defer reformatMuts[tab].Unlock()
|
||||||
// Use the current tab, but don't affect other tabs if the user switches tabs
|
// Use the current tab, but don't affect other tabs if the user switches tabs
|
||||||
reformatAndDisplayPage(tab, tabMap[tab])
|
reformatPageAndSetView(tab, tabMap[tab])
|
||||||
}(curTab)
|
}(curTab)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ func SwitchTab(tab int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
curTab = tab % NumTabs()
|
curTab = tab % NumTabs()
|
||||||
reformatAndDisplayPage(curTab, tabMap[curTab])
|
reformatPageAndSetView(curTab, tabMap[curTab])
|
||||||
tabPages.SwitchToPage(strconv.Itoa(curTab))
|
tabPages.SwitchToPage(strconv.Itoa(curTab))
|
||||||
tabRow.Highlight(strconv.Itoa(curTab)).ScrollToHighlight()
|
tabRow.Highlight(strconv.Itoa(curTab)).ScrollToHighlight()
|
||||||
|
|
||||||
|
@ -183,9 +183,9 @@ func reformatPage(p *structs.Page) {
|
|||||||
p.Width = termW
|
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.
|
// 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()
|
saveScroll()
|
||||||
reformatPage(p)
|
reformatPage(p)
|
||||||
tabViews[tab].SetText(p.Content)
|
tabViews[tab].SetText(p.Content)
|
||||||
|
Loading…
Reference in New Issue
Block a user