undo

package
v0.0.0-...-c88107b Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2018 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Text     string
	SelStart int
	SelEnd   int
}

Entry holds information about single undo entry

type Stack

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

Stack holds undo and redo entries

func NewStack

func NewStack(maxSize uint) *Stack

NewStack initializes and returns a Stack instance

func (*Stack) CanRedo

func (s *Stack) CanRedo() bool

CanRedo returns true if the redo list is not empty

func (*Stack) CanUndo

func (s *Stack) CanUndo() bool

CanUndo returns true if the undo list is not empty

func (*Stack) CurrentState

func (s *Stack) CurrentState() *Entry

CurrentState returns current state (entry current position is pointing to)

func (*Stack) Push

func (s *Stack) Push(entry *Entry)

Push pushes new state to the stack

func (*Stack) Redo

func (s *Stack) Redo() *Entry

Redo does one redo step: moves current position one step forward from redo to undo stack and returns the top entry on the undo stack (or nil if there are no more entries)

func (*Stack) Undo

func (s *Stack) Undo() *Entry

Undo does one undo step: moves current position one step back and returns the top entry on the undo stack (or nil if there are no more entries)

Jump to

Keyboard shortcuts

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