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 ConsumeLessTermcapEnvs ¶ added in v1.11.3
func ConsumeLessTermcapEnvs()
ConsumeLessTermcapEnvs parses LESS_TERMCAP_xx environment variables and adapts the moar output accordingly.
func NewScrollPositionFromLineNumberOneBased ¶ added in v1.9.3
Create a new position, scrolled to the given line number
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. 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 { Following bool // NewPager shows lines by default, this field can hide them ShowLineNumbers bool StatusBarStyle StatusBarStyle ShowStatusBar bool UnprintableStyle UnprintableStyle WrapLongLines bool // Ref: https://github.com/walles/moar/issues/113 QuitIfOneScreen bool // Ref: https://github.com/walles/moar/issues/94 ScrollLeftHint twin.Cell ScrollRightHint twin.Cell SideScrollAmount int // Should be positive // 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) ReprintAfterExit ¶ added in v1.8.4
After the pager has exited and the normal screen has been restored, you can call this method to print the pager contents to screen again, faking "leaving" pager contents on screen after exit.
func (*Pager) StartPaging ¶
StartPaging brings up the pager on screen
type Reader ¶
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.
Calling _wait() on this Reader will always return immediately, no asynchronous ops will be performed.
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 StatusBarStyle ¶ added in v1.8.5
type StatusBarStyle int
const ( STATUSBAR_STYLE_INVERSE StatusBarStyle = iota STATUSBAR_STYLE_PLAIN STATUSBAR_STYLE_BOLD )
type UnprintableStyle ¶ added in v1.8.6
type UnprintableStyle int
How do we render unprintable characters?
const ( UNPRINTABLE_STYLE_HIGHLIGHT UnprintableStyle = iota UNPRINTABLE_STYLE_WHITESPACE )