code

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code struct {
	*vp.Viewport

	NoContentStyle lipgloss.Style
	LineDigitStyle lipgloss.Style
	LineBarStyle   lipgloss.Style
	// contains filtered or unexported fields
}

Code is a code snippet.

func New

func New(c common.Common, content, extension string) *Code

New returns a new Code.

func (*Code) GotoBottom

func (r *Code) GotoBottom()

GotoBottom moves the viewport to the bottom of the log.

func (*Code) GotoTop

func (r *Code) GotoTop()

GotoTop moves the viewport to the top of the log.

func (*Code) HalfViewDown

func (r *Code) HalfViewDown()

HalfViewDown moves the viewport down by half the viewport height.

func (*Code) HalfViewUp

func (r *Code) HalfViewUp()

HalfViewUp moves the viewport up by half the viewport height.

func (*Code) Init

func (r *Code) Init() tea.Cmd

Init implements tea.Model.

func (*Code) LineDown

func (r *Code) LineDown(n int) []string

LineDown moves the viewport down by the given number of lines.

func (*Code) LineUp

func (r *Code) LineUp(n int) []string

LineUp moves the viewport up by the given number of lines.

func (*Code) ScrollPercent

func (r *Code) ScrollPercent() float64

ScrollPercent returns the viewport's scroll percentage.

func (*Code) SetContent

func (r *Code) SetContent(c, ext string) tea.Cmd

SetContent sets the content of the Code.

func (*Code) SetShowLineNumber

func (r *Code) SetShowLineNumber(show bool)

SetShowLineNumber sets whether to show line numbers.

func (*Code) SetSize

func (r *Code) SetSize(width, height int)

SetSize implements common.Component.

func (*Code) Update

func (r *Code) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (*Code) View

func (r *Code) View() string

View implements tea.View.

func (*Code) ViewDown

func (r *Code) ViewDown() []string

ViewDown moves the viewport down by a page.

func (*Code) ViewUp

func (r *Code) ViewUp() []string

ViewUp moves the viewport up by a page.

Jump to

Keyboard shortcuts

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