diff options
Diffstat (limited to 'state.go')
| -rw-r--r-- | state.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/state.go b/state.go new file mode 100644 index 0000000..5838fcd --- /dev/null +++ b/state.go @@ -0,0 +1,49 @@ +package main + +import ( + "net/url" + + "github.com/chzyer/readline" +) + +type BrowserState struct { + *History + + Modal []byte + Marks map[string]string + Readline *readline.Instance +} + +type History struct { + Url *url.URL + + Depth int + DocType string + Body []byte + Formatted string + Links []Link + + Back *History + Forward *History + + // Non-negative if we browsed here via a page link, else -1. + // + // The non-negative value is the index in the "back" page's + // list of links that got us here. + NavIndex int +} + +type Link struct { + Text string + Target *url.URL +} + +func NewBrowserState() *BrowserState { + return &BrowserState{ + History: &History{ + Url: nil, + Depth: 0, + NavIndex: -1, + }, + } +} |
