1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-11-03 02:37:23 -05:00
amfora/display/history.go

26 lines
513 B
Go
Raw Normal View History

2020-06-18 16:54:48 -04:00
package display
// applyHist is a history.go internal function, to load a URL in the history.
func applyHist(t *tab) {
handleURL(t, t.history.urls[t.history.pos], 0) // Load that position in history
t.applyAll()
2020-06-18 16:54:48 -04:00
}
func histForward(t *tab) {
if t.history.pos >= len(t.history.urls)-1 {
2020-06-18 16:54:48 -04:00
// Already on the most recent URL in the history
return
}
t.history.pos++
go applyHist(t)
2020-06-18 16:54:48 -04:00
}
func histBack(t *tab) {
if t.history.pos <= 0 {
2020-06-18 16:54:48 -04:00
// First tab in history
return
}
t.history.pos--
go applyHist(t)
2020-06-18 16:54:48 -04:00
}