Documentation
¶
Index ¶
Constants ¶
const BACKSPACE = '\b'
const MAX_HIGHLIGHT_SIZE int64 = 1024 * 1024
Files larger than this won't be highlighted
const NO_BREAK_SPACE = '\xa0'
Variables ¶
This section is empty.
Functions ¶
func SetManPageFormatFromEnv ¶
func SetManPageFormatFromEnv()
SetManPageFormatFromEnv parses LESS_TERMCAP_xx environment variables and adapts the moar output accordingly.
Types ¶
type InputLines ¶ added in v1.8.0
type InputLines struct {
// contains filtered or unexported fields
}
InputLines contains a number of lines from the reader, plus metadata
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
A Line represents a line of text that can / will be paged
func (*Line) HighlightedTokens ¶ added in v1.7.0
Returns a representation of the string split into styled tokens. Any regexp matches are highlighted in inverse video. A nil regexp means no highlighting.
type MatchRanges ¶
type MatchRanges struct {
Matches [][2]int
}
MatchRanges collects match indices
func (*MatchRanges) InRange ¶
func (mr *MatchRanges) InRange(index int) bool
InRange says true if the index is part of a regexp match
type Pager ¶
type Pager struct { // NewPager shows lines by default, this field can hide them ShowLineNumbers bool WrapLongLines bool // If true, pager will clear the screen on return. If false, pager will // clear the last line, and show the cursor. DeInit bool // contains filtered or unexported fields }
Pager is the main on-screen pager
func (*Pager) StartPaging ¶
StartPaging brings up the pager on screen
type Reader ¶
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 ¶
func NewReaderFromFilename(filename string, style chroma.Style, formatter chroma.Formatter) (*Reader, error)
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 ¶
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 ¶
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 ¶
GetLine gets a line. If the requested line number is out of bounds, nil is returned.
func (*Reader) GetLineCount ¶
GetLineCount returns the number of lines available for viewing
type RenderedLine ¶ added in v1.8.0
type RenderedLine struct {
// contains filtered or unexported fields
}
type ScreenLines ¶ added in v1.8.0
type ScreenLines struct {
// contains filtered or unexported fields
}