scroll

package
v0.0.0-...-bbcbdef Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commander

type Commander interface {
	Bindable(name string) bind.Bindable
	Execute(bind.Bindable)
}

type Controller

type Controller interface {
	ScrollToLine(int)
	ScrollToRune(int)
	SetScrollOffset(int)
	StartOffset() int
	LineIndex(int) int
}

Controller matches the type we need to control scrolling.

type Direction

type Direction int
const (
	NoDirection Direction = iota

	Up
)

type OnEdit

type OnEdit struct {
	Commander Commander
}

func (*OnEdit) Applied

func (o *OnEdit) Applied(e text.Editor, edits []text.Edit)

func (*OnEdit) Name

func (o *OnEdit) Name() string

func (*OnEdit) OpName

func (o *OnEdit) OpName() string

type Opt

type Opt func(*Scroller) *Scroller

Opt is an option function to be passed to Scroller.For

func ToLine

func ToLine(line int) Opt

ToLine is an Opt that sets s to scroll vertically, focusing on line. The horizontal position will not change.

func ToOldOffset

func ToOldOffset() Opt

ToOldOffset is an Opt that sets scroll in the stored position

func ToRune

func ToRune(pos int, dir Direction) Opt

ToRune is an Opt that sets s to scroll directly to a rune position.

type ScrolledHook

type ScrolledHook interface {
	Scrolled(e text.Editor, focus int)
}

ScrolledHook is a hook that will trigger whenever the view has scrolled.

type Scroller

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

Scroller is a bind.Op that is used to scroll the editor frame.

func (*Scroller) Bind

func (s *Scroller) Bind(b bind.Bindable) (bind.HookedMultiOp, error)

Bind clones s, binds b as a hook to the clone, and returns it.

func (*Scroller) Exec

func (s *Scroller) Exec() error

Exec executes s after it has stored all the values it needs.

func (*Scroller) For

func (s *Scroller) For(opts ...Opt) bind.Bindable

For returns a copy of s (as a bind.Bindable for dependency reasons) which has had the passed in opts applied.

func (*Scroller) Name

func (*Scroller) Name() string

Name returns Scroller's name.

func (*Scroller) Reset

func (s *Scroller) Reset()

Reset resets the execution state of s.

func (*Scroller) Store

func (s *Scroller) Store(elem interface{}) bind.Status

Store checks elem for the necessary methods and stores it if it's needed.

Jump to

Keyboard shortcuts

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