Documentation ¶
Overview ¶
Package oviewer provides a pager for terminals.
package main import ( "github.com/noborus/ov/oviewer" ) func main() { ov, err := oviewer.Open("main.go") if err != nil { panic(err) } if err := ov.Run(); err != nil { panic(err) } }
Index ¶
- Variables
- func GetKeyBinds(bind map[string][]string) map[string][]string
- func KeyBindString(k KeyBind) string
- type Config
- type Document
- type EventInput
- type Input
- type InputMode
- type KeyBind
- type Root
- func (root *Root) BackSearch(input string)
- func (root *Root) Help()
- func (root *Root) MoveBottom()
- func (root *Root) MoveLine(num int)
- func (root *Root) MoveTop()
- func (root *Root) Quit()
- func (root *Root) Run() error
- func (root *Root) Search(input string)
- func (root *Root) SetConfig(config Config) error
- func (root *Root) SetDocument(m *Document)
- func (root *Root) WriteOriginal()
- func (root *Root) WriteQuit()
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // HeaderStyle represents the style of the header. HeaderStyle = tcell.StyleDefault.Bold(true) // ColorAlternate represents alternating colors. ColorAlternate = tcell.ColorGray // OverStrikeStyle represents the overstrike style. OverStrikeStyle = tcell.StyleDefault.Bold(true) // OverLineStyle represents the overline underline style. OverLineStyle = tcell.StyleDefault.Underline(true) )
View Source
var ( // ErrOutOfRange indicates that value is out of range. ErrOutOfRange = errors.New("out of range") // ErrFatalCache indicates that the cache value had a fatal error. ErrFatalCache = errors.New("fatal error in cache value") // ErrMissingFile indicates that the file does not exist. ErrMissingFile = errors.New("missing filename") // ErrNotFound indicates not found. ErrNotFound = errors.New("not found") // ErrInvalidNumber indicates an invalid number. ErrInvalidNumber = errors.New("invalid number") )
View Source
var DefaultContent = content{ // contains filtered or unexported fields }
DefaultContent is a blank Content.
Functions ¶
func KeyBindString ¶
Types ¶
type Config ¶
type Config struct { // Alternating background color. ColorAlternate string // Header color. ColorHeader string // OverStrike color. ColorOverStrike string // OverLine color. ColorOverLine string Status status // AfterWrite writes the current screen on exit. AfterWrite bool // QuiteSmall Quit if the output fits on one screen. QuitSmall bool // CaseSensitive is case-sensitive if true CaseSensitive bool // Debug represents whether to enable the debug output. Debug bool // KeyBinding Keybind map[string][]string }
Config represents the settings of ov.
type Document ¶
type Document struct { // fileName is the file name to display. FileName string // contains filtered or unexported fields }
The Document structure contains the values for the logical screen.
type EventInput ¶
type EventInput interface { // Prompt returns the prompt string in the input field. Prompt() string // Confirm returns the event when the input is confirmed. Confirm(i string) tcell.Event // Up returns strings when the up key is pressed during input. Up(i string) string // Down returns strings when the down key is pressed during input. Down(i string) string }
EventInput is a generic interface for inputs.
type Input ¶
type Input struct { EventInput EventInput SearchCandidate *candidate GoCandidate *candidate DelimiterCandidate *candidate TabWidthCandidate *candidate // contains filtered or unexported fields }
Input represents the status of various inputs. Retain each input list to save the input history.
type Root ¶
type Root struct { // tcell.Screen is the root screen. tcell.Screen // Config contains settings that determine the behavior of ov. Config // Doc contains the model of ov Doc *Document // contains filtered or unexported fields }
The Root structure contains information about the drawing.
func NewOviewer ¶
NewOviewer return the structure of oviewer.
func (*Root) BackSearch ¶
BackSearch fires a backward search event.
func (*Root) MoveBottom ¶
func (root *Root) MoveBottom()
MoveBottom fires the event of moving to bottom.
func (*Root) SetDocument ¶
SetDocument fires a set document event.
func (*Root) WriteOriginal ¶
func (root *Root) WriteOriginal()
WriteOriginal writes to the original terminal.
Click to show internal directories.
Click to hide internal directories.