Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DeInit = true
If true, the Page function will clear the screen on return. If false, the Page function will clear the last line, and show the cursor.
Functions ¶
func Page ¶ added in v1.0.2
Page displays text in a pager.
The reader parameter can be constructed using one of: * NewReaderFromFilename() * NewReaderFromText() * NewReaderFromStream()
Or your could roll your own Reader based on the source code for any of those constructors.
func SetManPageFormatFromEnv ¶ added in v1.0.2
func SetManPageFormatFromEnv()
SetManPageFormatFromEnv parses LESS_TERMCAP_xx environment variables and adapts the moar output accordingly.
Types ¶
type Line ¶ added in v1.0.2
type Line struct {
// contains filtered or unexported fields
}
A Line represents a line of text that can / will be paged
func NewLine ¶ added in v1.0.2
NewLine creates a new Line from a (potentially ANSI / man page formatted) string
type Lines ¶ added in v1.0.2
type Lines struct {
// contains filtered or unexported fields
}
Lines contains a number of lines from the reader, plus metadata
type MatchRanges ¶ added in v1.0.2
type MatchRanges struct {
Matches [][2]int
}
MatchRanges collects match indices
func (*MatchRanges) InRange ¶ added in v1.0.2
func (mr *MatchRanges) InRange(index int) bool
InRange says true if the index is part of a regexp match
type Pager ¶ added in v1.0.2
type Pager struct { // NewPager shows lines by default, this field can hide them ShowLineNumbers bool // contains filtered or unexported fields }
Pager is the main on-screen pager
func (*Pager) Quit ¶ added in v1.0.2
func (p *Pager) Quit()
Quit leaves the help screen or quits the pager
func (*Pager) StartPaging ¶ added in v1.0.2
func (p *Pager) StartPaging(screen tcell.Screen)
StartPaging brings up the pager on screen
type Reader ¶ added in v1.0.2
type Reader struct {
// contains filtered or unexported fields
}
Reader reads a file into an array of strings.
It does the reading in the background, and it returns parts of the read data upon request.
This package provides query methods for the struct, no peeking!!
func NewReaderFromFilename ¶ added in v1.0.2
NewReaderFromFilename creates a new file reader.
The Reader will try to uncompress various compressed file format, and also apply highlighting to the file using Chroma: https://github.com/alecthomas/chroma
func NewReaderFromStream ¶ added in v1.0.2
NewReaderFromStream creates a new stream reader
The name can be an empty string ("").
If non-empty, the name will be displayed by the pager in the bottom left corner to help the user keep track of what is being paged.
func NewReaderFromText ¶ added in v1.0.2
NewReaderFromText creates a Reader from a block of text.
First parameter is the name of this Reader. This name will be displayed by Moar in the bottom left corner of the screen.
func (*Reader) GetLine ¶ added in v1.0.2
GetLine gets a line. If the requested line number is out of bounds, nil is returned.
func (*Reader) GetLineCount ¶ added in v1.0.2
GetLineCount returns the number of lines available for viewing