m

package
v1.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2025 License: BSD-2-Clause-Views Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const NO_BREAK_SPACE = '\xa0'

From: https://www.compart.com/en/unicode/U+00A0

Variables

This section is empty.

Functions

func NewScrollPositionFromIndex added in v1.32.0

func NewScrollPositionFromIndex(index linemetadata.Index, name string) scrollPosition

Create a new position, scrolled to the given line number

func PanicHandler added in v1.33.0

func PanicHandler(goroutineName string, recoverResult any, stackTrace []byte)

func TermcapToStyle added in v1.23.0

func TermcapToStyle(termcap string) (twin.Style, error)

Types

type FilteringReader added in v1.32.0

type FilteringReader struct {
	BackingReader reader.Reader

	// This is a reference to a reference so that we can track changes to the
	// original pattern, including if it is set to nil.
	FilterPattern **regexp.Regexp
	// contains filtered or unexported fields
}

func (*FilteringReader) GetLine added in v1.32.0

func (*FilteringReader) GetLineCount added in v1.32.0

func (f *FilteringReader) GetLineCount() int

func (*FilteringReader) GetLines added in v1.32.0

func (f *FilteringReader) GetLines(firstLine linemetadata.Index, wantedLineCount int) *reader.InputLines

func (*FilteringReader) ShouldShowLineCount added in v1.33.0

func (f *FilteringReader) ShouldShowLineCount() bool

type Pager

type Pager struct {

	// NewPager shows lines by default, this field can hide them
	ShowLineNumbers bool

	StatusBarStyle StatusBarOption
	ShowStatusBar  bool

	UnprintableStyle textstyles.UnprintableStyleT

	WrapLongLines bool

	// Ref: https://github.com/walles/moar/issues/113
	QuitIfOneScreen bool

	// Ref: https://github.com/walles/moar/issues/94
	ScrollLeftHint  twin.StyledRune
	ScrollRightHint twin.StyledRune

	SideScrollAmount int // Should be positive

	// If non-nil, scroll to this line as soon as possible. Set this value to
	// IndexMax() to follow the end of the input (tail).
	//
	// NOTE: Always use setTargetLine() to keep the reader in sync with the
	// pager!
	TargetLine *linemetadata.Index

	// If true, pager will clear the screen on return. If false, pager will
	// clear the last line, and show the cursor.
	DeInit bool

	// If DeInit is false, leave this number of lines for the shell prompt after
	// exiting
	DeInitFalseMargin int

	WithTerminalFg bool // If true, don't set linePrefix

	AfterExit func() error
	// contains filtered or unexported fields
}

Pager is the main on-screen pager

func NewPager

func NewPager(r *reader.ReaderImpl) *Pager

NewPager creates a new Pager with default settings

func (*Pager) Page

func (p *Pager) Page() error

Page displays text in a pager.

func (*Pager) Quit

func (p *Pager) Quit()

Quit leaves the help screen or quits the pager

func (*Pager) Reader added in v1.32.0

func (p *Pager) Reader() reader.Reader

func (*Pager) ReprintAfterExit added in v1.8.4

func (p *Pager) ReprintAfterExit() error

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

func (p *Pager) StartPaging(screen twin.Screen, chromaStyle *chroma.Style, chromaFormatter *chroma.Formatter)

StartPaging brings up the pager on screen

type PagerMode added in v1.22.0

type PagerMode interface {
	// contains filtered or unexported methods
}

type PagerModeFilter added in v1.32.0

type PagerModeFilter struct {
	// contains filtered or unexported fields
}

type PagerModeGotoLine added in v1.22.0

type PagerModeGotoLine struct {
	// contains filtered or unexported fields
}

type PagerModeJumpToMark added in v1.22.0

type PagerModeJumpToMark struct {
	// contains filtered or unexported fields
}

type PagerModeMark added in v1.22.0

type PagerModeMark struct {
	// contains filtered or unexported fields
}

type PagerModeNotFound added in v1.22.0

type PagerModeNotFound struct {
	// contains filtered or unexported fields
}

type PagerModeSearch added in v1.22.0

type PagerModeSearch struct {
	// contains filtered or unexported fields
}

type PagerModeViewing added in v1.22.0

type PagerModeViewing struct {
	// contains filtered or unexported fields
}

type SearchDirection added in v1.32.0

type SearchDirection int
const (
	SearchDirectionForward SearchDirection = iota
	SearchDirectionBackward
)

type StatusBarOption added in v1.20.0

type StatusBarOption int
const (
	//revive:disable-next-line:var-naming
	STATUSBAR_STYLE_INVERSE StatusBarOption = iota
	//revive:disable-next-line:var-naming
	STATUSBAR_STYLE_PLAIN
	//revive:disable-next-line:var-naming
	STATUSBAR_STYLE_BOLD
)

Directories

Path Synopsis
This package handles styled strings.
This package handles styled strings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL