goplayspace: github.com/iafan/goplayspace/client/component/editor/undo Index | Files

package undo

import "github.com/iafan/goplayspace/client/component/editor/undo"

Index

Package Files

undo.go

type Entry Uses

type Entry struct {
    Text     string
    SelStart int
    SelEnd   int
}

Entry holds information about single undo entry

type Stack Uses

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

Stack holds undo and redo entries

func NewStack Uses

func NewStack(maxSize uint) *Stack

NewStack initializes and returns a Stack instance

func (*Stack) CanRedo Uses

func (s *Stack) CanRedo() bool

CanRedo returns true if the redo list is not empty

func (*Stack) CanUndo Uses

func (s *Stack) CanUndo() bool

CanUndo returns true if the undo list is not empty

func (*Stack) CurrentState Uses

func (s *Stack) CurrentState() *Entry

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

func (*Stack) Push Uses

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

Push pushes new state to the stack

func (*Stack) Redo Uses

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 Uses

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)

Package undo is imported by 2 packages. Updated 2017-08-07. Refresh now. Tools for package owners.