Documentation
¶
Index ¶
- func Apply(peer, str string, repl []Replacement) string
- func As[T any](v any) T
- func Isa[T any](v any) bool
- func RemoveMarker(tree opTree, name string) opTree
- func ShiftDeletesRight(left opTree, right opTree) (opTree, opTree)
- func ShiftInsertsRight(left opTree, right opTree) (opTree, opTree)
- func SplitNew(tree opTree, offset int) (opTree, opTree)
- func SplitOld(tree opTree, offset int) (opTree, opTree)
- func SplitOnMarker(tree opTree, name string) (opTree, opTree)
- type DeleteOp
- type Document
- func (d *Document) Apply(peer string, edits []Replacement)
- func (d *Document) Copy() *Document
- func (d *Document) Edits() []Replacement
- func (d *Document) Freeze() *Document
- func (a *Document) Merge(b *Document)
- func (d *Document) OpString() string
- func (d *Document) OriginalString() string
- func (d *Document) Replace(peer string, start int, length int, str string)
- func (d *Document) ReverseEdits() []Replacement
- func (d *Document) SplitOnMarker(name string) (opTree, opTree)
- func (d *Document) String() string
- type Measure
- type OpMeasurer
- type Operation
- type Replacement
- type RetainOp
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply(peer, str string, repl []Replacement) string
func RemoveMarker ¶ added in v0.0.3
func RemoveMarker(tree opTree, name string) opTree
func ShiftDeletesRight ¶ added in v0.0.4
func ShiftDeletesRight(left opTree, right opTree) (opTree, opTree)
if left ends in deletes and (optionally) markers, shift them to right
func ShiftInsertsRight ¶ added in v0.0.4
func ShiftInsertsRight(left opTree, right opTree) (opTree, opTree)
if left ends in inserts and (optionally) markers, shift them to right
func SplitNew ¶ added in v0.0.4
func SplitNew(tree opTree, offset int) (opTree, opTree)
SplitNew the tree's new text at an offset
func SplitOld ¶ added in v0.0.4
func SplitOld(tree opTree, offset int) (opTree, opTree)
split the tree's old text at an offset
func SplitOnMarker ¶ added in v0.0.3
func SplitOnMarker(tree opTree, name string) (opTree, opTree)
Types ¶
type Document ¶ added in v0.0.3
type Document struct {
Ops opTree
}
func NewDocument ¶ added in v0.0.4
func (*Document) Apply ¶ added in v0.0.3
func (d *Document) Apply(peer string, edits []Replacement)
func (*Document) Edits ¶ added in v0.0.3
func (d *Document) Edits() []Replacement
append Edits that restore the original document
func (*Document) Merge ¶ added in v0.0.3
Merge operations from the same ancestor document into this one
func (*Document) OriginalString ¶ added in v0.0.3
string for the original document
func (*Document) ReverseEdits ¶ added in v0.0.3
func (d *Document) ReverseEdits() []Replacement
append edits that restore the original document
func (*Document) SplitOnMarker ¶ added in v0.0.3
type OpMeasurer ¶ added in v0.0.4
type OpMeasurer bool
func (OpMeasurer) Identity ¶ added in v0.0.4
func (m OpMeasurer) Identity() Measure
func (OpMeasurer) Measure ¶ added in v0.0.4
func (m OpMeasurer) Measure(op Operation) Measure
type Replacement ¶
type Set ¶ added in v0.0.2
type Set[T comparable] map[T]bool
func NewSet ¶ added in v0.0.3
func NewSet[T comparable](elements ...T) Set[T]
Click to show internal directories.
Click to hide internal directories.