Documentation
¶
Overview ¶
Package ui holds the browser chrome state independent of terminal I/O.
Index ¶
- Constants
- type Action
- type ActionKind
- type Model
- func (m *Model) AddressTrimmed() string
- func (m *Model) CancelFooterPress()
- func (m *Model) Chrome(cols int) []string
- func (m *Model) ClearHints()
- func (m *Model) CloseOverlay()
- func (m *Model) FocusPage()
- func (m *Model) Footer(bookmarked bool) string
- func (m *Model) FooterMouseActive() bool
- func (m *Model) Handle(ev term.Event) Action
- func (m *Model) HandleFooterKey(ev term.Event) (Action, bool)
- func (m *Model) HandleFooterMouse(cols, rows int, mouse term.MouseEvent) Action
- func (m *Model) HandleMouse(cols int, mouse term.MouseEvent) Action
- func (m *Model) Header() string
- func (m *Model) OpenOverlay(kind OverlayKind, items []string)
- func (m *Model) SetHints(hints []browser.Hint)
- func (m *Model) SetLists(history, bookmarks []string)
- func (m *Model) SetText(text string)
- func (m *Model) SetURL(url string)
- func (m *Model) TextView(rows, width int) []string
- type OverlayKind
- type TabInfo
Constants ¶
const ChromeRows = 2
ChromeRows is the number of terminal rows reserved for browser chrome.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
Kind ActionKind
URL string
Label string
Hint *browser.Hint
Index int
PauseGeneration uint64
InstanceEpoch string
}
Action is the result of one key event.
type ActionKind ¶
type ActionKind int
ActionKind is a command the caller should run against the browser.
const ( ActionNone ActionKind = iota ActionBack ActionForward ActionReload ActionShowHints ActionHint ActionClearHints ActionOpenHistory ActionOpenBookmarks ActionToggleBookmark ActionOverlaySelect ActionOverlayClose ActionToggleText ActionTextScroll ActionScreenshot ActionScreenshotFull ActionNewTab ActionSelectTab ActionCloseTab ActionEditAddress ActionQuit ActionResumeAutomation ActionKeepPaused )
type Model ¶
type Model struct {
URL string
Address string
Editing bool
Status string
Tabs []TabInfo
ActiveTab int
CanGoBack bool
CanGoForward bool
Private bool
AgentActive bool
Interaction host.InteractionState
ResumeBusy bool
ResumeUnknown bool
HintMode bool
HintBuffer string
Hints []browser.Hint
Overlay OverlayKind
OverlayItems []string
OverlayIndex int
HistoryURLs []string
BookmarkURLs []string
TextMode bool
TextLines []string
TextTop int
// contains filtered or unexported fields
}
Model is the address bar and status state.
func (*Model) AddressTrimmed ¶
AddressTrimmed returns the address without surrounding whitespace.
func (*Model) CancelFooterPress ¶ added in v0.2.12
func (m *Model) CancelFooterPress()
func (*Model) Chrome ¶ added in v0.2.0
Chrome renders the tab strip and toolbar. Untrusted text is sanitized, but Unicode is preserved; layout and mouse hitboxes use display cells, not bytes.
func (*Model) FocusPage ¶ added in v0.2.19
func (m *Model) FocusPage()
FocusPage clears any recovery button focus before addressing page controls. Selecting a page never changes the automation pause itself.
func (*Model) FooterMouseActive ¶ added in v0.2.12
func (*Model) HandleFooterKey ¶ added in v0.2.12
Footer focus is bound when Tab is pressed, not reinterpreted for a later pause. Enter/Space never become an extra page key after selecting a button.
func (*Model) HandleFooterMouse ¶ added in v0.2.12
func (m *Model) HandleFooterMouse(cols, rows int, mouse term.MouseEvent) Action
HandleFooterMouse always consumes the footer outside the webpage. A click completes only on release over the same button and pause generation.
func (*Model) HandleMouse ¶ added in v0.2.0
func (m *Model) HandleMouse(cols int, mouse term.MouseEvent) Action
HandleMouse maps a press to the same parts used by Chrome. Mouse positions are one-based SGR terminal coordinates. A page press releases address editing so the newly focused page input, not the toolbar, receives the next key.
func (*Model) OpenOverlay ¶
func (m *Model) OpenOverlay(kind OverlayKind, items []string)
OpenOverlay shows one picker.
type OverlayKind ¶
type OverlayKind int
OverlayKind selects the one-line picker.
const ( OverlayNone OverlayKind = iota OverlayHistory OverlayBookmarks )