begin reuse of widgets across pages

This commit is contained in:
Drew Weymouth
2023-07-07 12:54:20 -07:00
parent a8d1380b48
commit c6c33ecfed
10 changed files with 186 additions and 67 deletions
+6 -2
View File
@@ -233,17 +233,21 @@ func (b *BrowsingPane) GoHome() {
func (b *BrowsingPane) GoBack() {
if b.historyIdx > 0 {
// due to widget reuse between pages,
// we must create the new page before calling addPageToHistory
p := b.history[b.historyIdx-1].Restore()
b.addPageToHistory(b.curPage, false)
b.historyIdx -= 2
b.doSetPage(b.history[b.historyIdx].Restore())
b.doSetPage(p)
b.updateHistoryButtons()
}
}
func (b *BrowsingPane) GoForward() {
if b.historyIdx < len(b.history)-1 {
p := b.history[b.historyIdx+1].Restore()
b.addPageToHistory(b.curPage, false)
b.doSetPage(b.history[b.historyIdx].Restore())
b.doSetPage(p)
b.updateHistoryButtons()
}
}