1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-09-27 23:05:55 -04:00
amfora/display/history.go
2020-07-06 12:10:50 -04:00

36 lines
901 B
Go

package display
func histForward() {
if tabs[curTab].history.pos >= len(tabs[curTab].history.urls)-1 {
// Already on the most recent URL in the history
return
}
tabs[curTab].history.pos++
go func(tab int) {
handleURL(tab, tabs[tab].history.urls[tabs[tab].history.pos]) // Load that position in history
tabs[tab].applyScroll()
tabs[tab].applySelected()
if tab == curTab {
// Display the bottomBar state that handleURL set
tabs[tab].applyBottomBar()
}
}(curTab)
}
func histBack() {
if tabs[curTab].history.pos <= 0 {
// First tab in history
return
}
tabs[curTab].history.pos--
go func(tab int) {
handleURL(tab, tabs[tab].history.urls[tabs[tab].history.pos]) // Load that position in history
tabs[tab].applyScroll()
tabs[tab].applySelected()
if tab == curTab {
// Display the bottomBar state that handleURL set
tabs[tab].applyBottomBar()
}
}(curTab)
}