Documentation
¶
Index ¶
- Constants
- type Mode
- type View
- func (v *View) AddDigitToSelector(digit int)
- func (v *View) ClearSelector()
- func (v View) Draw(screen tcell.Screen)
- func (v *View) FixLineOffset(screen tcell.Screen)
- func (v *View) HideURLs()
- func (v View) IsEmpty() bool
- func (v View) LinkURL() string
- func (v *View) Scroll(screen tcell.Screen, lines int)
- func (v *View) ScrollDownToNextSearchMatch(screen tcell.Screen) bool
- func (v *View) ScrollDownToSearchMatch(screen tcell.Screen) bool
- func (v *View) ScrollToBottom(screen tcell.Screen)
- func (v *View) ScrollToNextHeading(screen tcell.Screen)
- func (v *View) ScrollToNthHeading(screen tcell.Screen, n int)
- func (v *View) ScrollToPrevHeading(screen tcell.Screen)
- func (v *View) ScrollToTop(screen tcell.Screen)
- func (v *View) ScrollUpToNextSearchMatch(screen tcell.Screen) bool
- func (v *View) ScrollUpToSearchMatch(screen tcell.Screen) bool
- func (v View) SelectorIndex() int
- func (v View) SelectorIsValid() bool
- func (v *View) ShowURLs()
- func (v View) TOCView() View
Constants ¶
const ( Regular = Mode(iota) Search // Typing a search term. ReverseSearch // Typing a search term for reverse search. )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type View ¶
type View struct { // Number of columns to shift the content to the left. Useful for // viewing preformatted text, that is wider than the screen. The // shifting will be limited by the widest preformatted line in lines. ColOffset int Mode Mode Searchterm string // The search term while it is being typed. Cursor int // Index of first byte of cursored rune in Searchterm. May be up to len(Searchterm). Searchpattern *regexp.Regexp // The active search pattern. // If not "", this info is displayed in the bar. Useful for infos like // "Invalid search pattern" or "No match found". Info string // contains filtered or unexported fields }
A View represents the whole state related to a document, including its content and scroll position.
func (*View) AddDigitToSelector ¶ added in v0.3.0
AddDigitToSelector adds a single digit to the end of v.selector.
func (*View) ClearSelector ¶ added in v0.3.0
func (v *View) ClearSelector()
ClearSelector sets v.selector to an empty string.
func (View) Draw ¶
func (v View) Draw(screen tcell.Screen)
Draw draws the given view to screen. The screen is separated like this:
7cols 11cols 10cols 18cols ┌───────┬───────────┬──────────┬──────────────────┐ │ left │ selectors │ rendered │ right space │ │ space │ │ gmi │ │ │ │ │ │ │ ├───────┴───────────┴──────────┴──────────────────┤ │ bar │ └─────────────────────────────────────────────────┘
The rendered gmi aims to be a width that is comfortable to read. The right space may be intruded by preformatted lines. The selector column will always be wide enough to fit the largest selector in the document.
func (*View) FixLineOffset ¶
func (v *View) FixLineOffset(screen tcell.Screen)
FixLineOffset fixes v.lineOffset to ensure it does not go over the amount of actually available wrapped lines. Use after screen resize or any other event that changes the amount of wraps for a line.
func (*View) HideURLs ¶ added in v0.3.0
func (v *View) HideURLs()
HideURLs disables the display of URLs for link lines.
func (*View) Scroll ¶
Scroll scrolls up or down the given amount of (wrapped) lines. Scrolls up, if lines is negative. Never scrolls past the top or bottom line.
func (*View) ScrollDownToNextSearchMatch ¶
ScrollDownToSearchMatch scrolls to the next line, that matches v.Searchpattern.
Returns false, if none of the lines after the current one matches v.Searchpattern.
func (*View) ScrollDownToSearchMatch ¶
ScrollDownToSearchMatch scrolls to the next line, that matches v.Searchpattern. If the current line matches v.Searchpattern, nothing is done.
Returns false, if neither the current line nor any line after matches v.Searchpattern.
func (*View) ScrollToBottom ¶
func (v *View) ScrollToBottom(screen tcell.Screen)
ScrollToBottom scrolls to the last line.
func (*View) ScrollToNextHeading ¶
func (v *View) ScrollToNextHeading(screen tcell.Screen)
ScrollToNextHeading scrolls to the first line of the next heading.
func (*View) ScrollToNthHeading ¶ added in v0.3.0
ScrollToNthHeading scrolls to the first line of the nth heading.
func (*View) ScrollToPrevHeading ¶
func (v *View) ScrollToPrevHeading(screen tcell.Screen)
ScrollToPrevHeading scrolls to the first line of the previous heading.
func (*View) ScrollToTop ¶
func (v *View) ScrollToTop(screen tcell.Screen)
ScrollToTop scrolls to the first line.
func (*View) ScrollUpToNextSearchMatch ¶
ScrollUpToSearchMatch scrolls to the previous line, that matches v.Searchpattern.
Returns false, if none of the lines after the current one matches v.Searchpattern.
func (*View) ScrollUpToSearchMatch ¶
ScrollUpToSearchMatch scrolls to the previous line, that matches v.Searchpattern. If the current line matches v.Searchpattern, nothing is done.
Returns false, if neither the current line nor any line after matches v.Searchpattern.
func (View) SelectorIndex ¶ added in v0.3.0
SelectorNumber returns the currently selected index.
func (View) SelectorIsValid ¶ added in v0.3.0
SelectorIsValid returns true, if the selector is complete and resolves to a valid selectable.