history

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeLastTwoEdits

func MergeLastTwoEdits(h *History)

func MergeTwoEdits

func MergeTwoEdits(h *History, tce *TwoConsecutiveEdits)

func TryToMergeLastTwoEdits

func TryToMergeLastTwoEdits(h *History)

Types

type Edit

type Edit struct {
	PreState  interface{}
	PostState interface{}
	// contains filtered or unexported fields
}

func (*Edit) Append

func (edit *Edit) Append(data *iorw.UndoRedo)

func (*Edit) ApplyUndoRedo

func (edit *Edit) ApplyUndoRedo(w iorw.Writer, redo bool, restore func(interface{})) error

func (*Edit) Empty

func (edit *Edit) Empty() bool

func (*Edit) Entries

func (edit *Edit) Entries() []*iorw.UndoRedo

type History

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

func NewHistory

func NewHistory(maxSize int) *History

func (*History) Append

func (h *History) Append(edit *Edit)

func (*History) Clear

func (h *History) Clear()

func (*History) ClearForward

func (h *History) ClearForward()

func (*History) ClearOldN

func (h *History) ClearOldN(n int)

func (*History) UndoRedo

func (h *History) UndoRedo(redo bool) *Edit

type TwoConsecutiveEdits

type TwoConsecutiveEdits struct {
	Ed1, Ed2     *Edit
	Elem1, Elem2 **list.Element
}

func LastTwoEdits

func LastTwoEdits(h *History) (*TwoConsecutiveEdits, bool)

Jump to

Keyboard shortcuts

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