cursor

package
v0.0.0-...-7ebf4b2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blink() tea.Msg

Blink is a command used to initialize cursor blinking.

Types

type BlinkMsg

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

BlinkMsg signals that the cursor should blink. It contains metadata that allows us to tell if the blink message is the one we're expecting.

type Mode

type Mode int

Mode describes the behavior of the cursor.

const (
	CursorBlink Mode = iota
	CursorStatic
	CursorHide
)

Available cursor modes.

func (Mode) String

func (c Mode) String() string

String returns the cursor mode in a human-readable format. This method is provisional and for informational purposes only.

type Model

type Model struct {
	BlinkSpeed time.Duration
	// Style for styling the cursor block.
	Style lipgloss.Style
	// TextStyle is the style used for the cursor when it is hidden (when blinking).
	// I.e. displaying normal text.
	TextStyle lipgloss.Style

	// Cursor Blink state.
	Blink bool
	// contains filtered or unexported fields
}

Model is the Bubble Tea model for this cursor element.

func New

func New() Model

New creates a new model with default settings.

func (*Model) BlinkCmd

func (m *Model) BlinkCmd() tea.Cmd

BlinkCmd is a command used to manage cursor blinking.

func (*Model) Blur

func (m *Model) Blur()

Blur blurs the cursor.

func (*Model) Focus

func (m *Model) Focus() tea.Cmd

Focus focuses the cursor to allow it to blink if desired.

func (Model) Mode

func (m Model) Mode() Mode

Mode returns the model's cursor mode. For available cursor modes, see type Mode.

func (*Model) SetChar

func (m *Model) SetChar(char string)

SetChar sets the character under the cursor.

func (*Model) SetMode

func (m *Model) SetMode(mode Mode) tea.Cmd

SetMode sets the model's cursor mode. This method returns a command.

For available cursor modes, see type CursorMode.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update updates the cursor.

func (Model) View

func (m Model) View() string

View displays the cursor.

Jump to

Keyboard shortcuts

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