Buffer Identifier #
Identifies which buffer a piece points to
Instances For
Equations
Equations
- Lapis.VFS.PieceTable.instBEqBuffer.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Piece Descriptor #
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Create an empty piece
Equations
- Lapis.VFS.PieceTable.Piece.empty = { buffer := Lapis.VFS.PieceTable.Buffer.original, start := 0, length := 0, lineBreaks := 0, utf16Length := 0 }
Instances For
Pieces are measurable for the finger tree
Equations
- Lapis.VFS.PieceTable.instMeasurablePiece = { measure := fun (p : Lapis.VFS.PieceTable.Piece) => { bytes := p.length, utf16Units := p.utf16Length, lines := p.lineBreaks } }
Text Buffers #
The two text buffers backing the piece table
Instances For
Equations
Instances For
Create buffers from initial document content
Equations
- Lapis.VFS.PieceTable.TextBuffers.fromContent content = { original := content, add := "" }
Instances For
Get text for a piece from the appropriate buffer
Equations
- One or more equations did not get rendered due to their size.
Instances For
Append text to the add buffer, returning new buffers and the start position
Equations
Instances For
Piece Table State #
The complete piece table state using a finger tree of pieces
- buffers : TextBuffers
- pieces : FingerTree.FingerTree Piece
Instances For
Equations
Instances For
Create a piece table from initial content
Equations
- One or more equations did not get rendered due to their size.
Instances For
Get the total line count
Instances For
Get the total UTF-16 length
Equations
- state.utf16Length = state.pieces.measure.utf16Units
Instances For
Get all text content
Equations
- state.getContent = Lapis.VFS.FingerTree.FingerTree.foldl (fun (acc : String) (p : Lapis.VFS.PieceTable.Piece) => acc ++ state.buffers.getPieceText p) "" state.pieces
Instances For
def
Lapis.VFS.PieceTable.PieceTableState.getTextByteRange
(state : PieceTableState)
(startByte endByte : Nat)
:
Get text in a byte range
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[irreducible]
def
Lapis.VFS.PieceTable.PieceTableState.getTextByteRange.getTextByteRangeAux
(pieces : Array Piece)
(buffers : TextBuffers)
(startByte endByte idx currentByte : Nat)
(result : String)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lapis.VFS.PieceTable.PieceTableState.insertAt
(state : PieceTableState)
(bytePos : Nat)
(text : String)
:
Insert text at a byte position - O(log n)
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lapis.VFS.PieceTable.PieceTableState.deleteRange
(state : PieceTableState)
(startByte endByte : Nat)
:
Delete text in a byte range - O(log n)
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lapis.VFS.PieceTable.PieceTableState.replaceRange
(state : PieceTableState)
(startByte endByte : Nat)
(text : String)
:
Replace text in a byte range - O(log n)
Equations
- state.replaceRange startByte endByte text = (state.deleteRange startByte endByte).insertAt startByte text
Instances For
Piece Coalescing #
Compact the piece table by merging adjacent same-buffer pieces
Equations
- One or more equations did not get rendered due to their size.