Documentation
¶
Index ¶
- func Apply(id, str string, offset int, repl []Replacement) string
- func As[T any](v any) T
- func Changes(prefix string, ops OpTree) string
- func Isa[T any](v any) bool
- func Len(op Operation) int
- func LenTree(tree OpTree) int
- func OpString(tree OpTree, verbose bool) string
- func Overlaps(op1 Operation, op2 Operation) bool
- func OverlapsRange(op1 Operation, offset, len int) bool
- func Owner(op Operation) string
- func RangesOverlap(off1, len1, off2, len2 int) bool
- func ReplEnd(op Operation) int
- func ReplOffset(op Operation) int
- func SplitNew(tree OpTree, offset int) (OpTree, OpTree)
- func SplitOnMarker(tree OpTree, name string) (OpTree, OpTree)
- func SplitOp(op Operation, split int) (Operation, Operation)
- func Width(repl []Replacement) int
- type DeleteOp
- func (d *DeleteOp) CopyWith(offset int, text string) Operation
- func (d *DeleteOp) GetId() ReplId
- func (d *DeleteOp) GetText() string
- func (d *DeleteOp) Len() int
- func (d *DeleteOp) Measure() Measure
- func (d *DeleteOp) Merge(m *Merger) bool
- func (d *DeleteOp) OpString(offset int, verbose bool) string
- func (d *DeleteOp) Overlaps(offset1, del *DeleteOp) bool
- func (d *DeleteOp) OverlapsRange(offset2, len int) bool
- func (d *DeleteOp) String() string
- type Document
- func (d *Document) Apply(id string, offset int, edits []Replacement)
- func (d *Document) Changes(prefix string) string
- func (d *Document) Copy() *Document
- func (d *Document) Edits() []Replacement
- func (d *Document) Freeze() *Document
- func (d *Document) GetOps() OpTree
- func (d *Document) Mark(name string, offset int)
- func (d *Document) Merge(b *Document)
- func (d *Document) NewMerger() *Merger
- func (d *Document) OpString(verbose bool) string
- func (d *Document) OriginalString() string
- func (d *Document) Replace(peerParent string, replOffset, start, length int, str string)
- func (d *Document) ReverseEdits() []Replacement
- func (d *Document) Reversed(oldBase, newBase string) *Document
- func (d *Document) SetOps(newOps OpTree)
- func (d *Document) Simplify()
- func (d *Document) SplitOnMarker(name string) (OpTree, OpTree)
- func (d *Document) String() string
- type InsertOp
- func (i *InsertOp) CopyWith(offset int, text string) Operation
- func (i *InsertOp) GetId() ReplId
- func (i *InsertOp) GetText() string
- func (i *InsertOp) Measure() Measure
- func (i *InsertOp) Merge(m *Merger) bool
- func (i *InsertOp) OpString(offset int, verbose bool) string
- func (i *InsertOp) String() string
- type MarkerOp
- func (m *MarkerOp) CopyWith(offset int, text string) Operation
- func (m *MarkerOp) GetId() ReplId
- func (m *MarkerOp) GetText() string
- func (m *MarkerOp) Measure() Measure
- func (opA *MarkerOp) Merge(m *Merger) bool
- func (m *MarkerOp) OpString(offset int, verbose bool) string
- func (m *MarkerOp) String() string
- type Measure
- type Merger
- type OpMeasurer
- type OpTree
- type Operation
- type RangeMeasurer
- type ReplId
- type ReplMergeState
- type Replacement
- type Set
- func (s Set[T]) Add(op T) Set[T]
- func (s Set[T]) Compliment(s2 Set[T])
- func (s Set[T]) Copy() Set[T]
- func (s Set[T]) Has(op T) bool
- func (s Set[T]) IsEmpty() bool
- func (s Set[T]) Merge(s2 Set[T]) Set[T]
- func (s Set[T]) Remove(op T) Set[T]
- func (s Set[T]) ToSlice() []T
- func (s Set[T]) Union(s2 Set[T]) Set[T]
- type TextRange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OverlapsRange ¶ added in v0.0.13
func RangesOverlap ¶ added in v0.0.13
func ReplOffset ¶ added in v0.0.13
func Width ¶ added in v0.0.14
func Width(repl []Replacement) int
Types ¶
type DeleteOp ¶ added in v0.0.4
func (*DeleteOp) OverlapsRange ¶ added in v0.0.13
type Document ¶ added in v0.0.3
type Document struct {
// contains filtered or unexported fields
}
func NewDocument ¶ added in v0.0.4
func (*Document) Apply ¶ added in v0.0.3
func (d *Document) Apply(id string, offset int, 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 another version of the original 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) Reversed ¶ added in v0.0.14
insert <--> delete newBase ops are transformed to "" "" ops are transformed to oldBase
func (*Document) SplitOnMarker ¶ added in v0.0.3
type InsertOp ¶ added in v0.0.5
type InsertOp struct {
Id ReplId // ID of the peerParent block, for ordering, "" is original text
//PrevId string // the previous text -- could be an insert or a delete
//PrevOffset int
//PrevBefore bool // whether or not the previous text lies before this insert
Text string
}
type MarkerOp ¶ added in v0.0.5
type Merger ¶ added in v0.0.8
type Merger struct {
Swapped bool
OpA, OpB Operation
Result, TreeA, TreeB ft.FingerTree[OpMeasurer, Operation, Measure]
BaseEdits map[string]ft.FingerTree[OpMeasurer, Operation, Measure]
ReplMap map[ReplId]Operation
Used Set[ReplId]
Marked Set[string]
// contains filtered or unexported fields
}
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 OpTree ¶ added in v0.0.6
type OpTree = ft.FingerTree[OpMeasurer, Operation, Measure]
func RemoveMarker ¶ added in v0.0.3
type RangeMeasurer ¶ added in v0.0.13
type RangeMeasurer bool
func (RangeMeasurer) Identity ¶ added in v0.0.13
func (m RangeMeasurer) Identity() TextRange
func (RangeMeasurer) Measure ¶ added in v0.0.13
func (m RangeMeasurer) Measure(r TextRange) TextRange
func (RangeMeasurer) Sum ¶ added in v0.0.13
func (m RangeMeasurer) Sum(m1, m2 TextRange) TextRange
type ReplId ¶ added in v0.0.13
a unique id for an insert or delete the parentId of the block and the offset within the concatenation of the replacments
type ReplMergeState ¶ added in v0.0.13
type ReplMergeState struct {
// contains filtered or unexported fields
}
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]
func (Set[T]) Compliment ¶ added in v0.0.13
Click to show internal directories.
Click to hide internal directories.