Documentation
¶
Index ¶
- type Buffer
- func (buf *Buffer) CreateTrack(row int, bytePos int) *Track
- func (buf *Buffer) GetLineAt(row int) *Line
- func (buf *Buffer) GetLineCount() int
- func (buf *Buffer) Init()
- func (buf *Buffer) InsertString(row int, column int, s string) (Position, error)
- func (buf *Buffer) RemoveString(row int, column int, length int)
- func (buf *Buffer) RemoveTrack(track *Track)
- func (buf *Buffer) ReplaceAll(r io.Reader)
- type BufferSegment
- type Document
- type Element
- type FoldBlockElement
- type GhostElement
- type Line
- type PlainDocument
- func (doc *PlainDocument) Clear()
- func (doc *PlainDocument) CreateTrack(row int, bytePos int) *Track
- func (doc *PlainDocument) GetLineBytes(index int) int
- func (doc *PlainDocument) GetLineCount() int
- func (doc *PlainDocument) GetLineString(lineIndex int) string
- func (doc *PlainDocument) GetVersion() uint
- func (doc *PlainDocument) Init()
- func (doc *PlainDocument) InsertString(row int, bytePos int, s string)
- func (doc *PlainDocument) Read(r Range) Segment
- func (doc *PlainDocument) Remove(row int, bytePos int, byteLen int)
- func (doc *PlainDocument) Render() []Element
- func (doc *PlainDocument) ReplaceAll(r io.Reader)
- type PlainElement
- type Position
- type Range
- type Segment
- type Span
- type Track
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is array of line strings. Buffer API's require and returns unit of codepoint positions.
func (*Buffer) CreateTrack ¶ added in v0.3.0
CreateTrack creates a new position tracker.
func (*Buffer) GetLineCount ¶
GetLineCount returns count of lines.
func (*Buffer) InsertString ¶
InsertString is insert string into specified position.
func (*Buffer) RemoveString ¶
RemoveString is remove string specified range.
func (*Buffer) RemoveTrack ¶ added in v0.3.0
RemoveTrack removes a position tracker from the buffer.
func (*Buffer) ReplaceAll ¶ added in v0.3.0
ReplaceAll is replace a all content by Reader content
type BufferSegment ¶ added in v0.3.0
type BufferSegment struct {
// contains filtered or unexported fields
}
func (BufferSegment) GetLine ¶ added in v0.3.0
func (bs BufferSegment) GetLine(lineIndex int) string
func (BufferSegment) GetLineCount ¶ added in v0.3.0
func (bs BufferSegment) GetLineCount() int
func (BufferSegment) GetSpan ¶ added in v0.3.0
func (bs BufferSegment) GetSpan(lineIndex int) Span
type Document ¶
type Document interface {
// Read returns Segment on specified range.
Read(r Range) Segment
// Render is presentation a contain string as structured element.
Render() []Element
// InsertString is insert string into specified position.
InsertString(row int, bytePos int, s string)
// Remove is remove string in specified range.
Remove(row int, bytePos int, byteLen int)
// ReplaceAll is replace a all content by Reader content
ReplaceAll(r io.Reader)
// Clear is remove all strings.
Clear()
// CreateTrack creates a new position tracker.
CreateTrack(row int, bytePos int) *Track
// GetLineBytes returns total byte count at specified line.
GetLineBytes(index int) int
// GetLineCount returns total line count.
GetLineCount() int
// GetVersion returns version. version is changed on modify string.
GetVersion() uint
}
Document is model for TextBox, and contain string. most important method of Document is Render. TextBox get Element through Render method for rendering. and TextViewResolver is mapping Element to TextView. This results in TextBox is got TextView from structured Element. This is it rendering core. more details is see TextView, TextViewResolver
type Element ¶ added in v0.3.0
type Element interface {
// GetRange returns range at specified index.
// zero index is always inclusive all range.
GetRange(index int) Range
// GetRangeCount returns count of ranges.
GetRangeCount() int
// GetElement returns subelement at specified index.
GetElement(index int) Element
// GetElementCount returns count of elements.
GetElementCount() int
}
Element is part of structured document. in example, Heading, Bold, Italic...
type FoldBlockElement ¶ added in v0.3.0
func (*FoldBlockElement) GetElement ¶ added in v0.3.0
func (f *FoldBlockElement) GetElement(index int) Element
func (*FoldBlockElement) GetElementCount ¶ added in v0.3.0
func (f *FoldBlockElement) GetElementCount() int
func (*FoldBlockElement) GetRange ¶ added in v0.3.0
func (f *FoldBlockElement) GetRange(index int) Range
func (*FoldBlockElement) GetRangeCount ¶ added in v0.3.0
func (f *FoldBlockElement) GetRangeCount() int
type GhostElement ¶ added in v0.3.0
func (*GhostElement) GetElement ¶ added in v0.3.0
func (g *GhostElement) GetElement(index int) Element
func (*GhostElement) GetElementCount ¶ added in v0.3.0
func (g *GhostElement) GetElementCount() int
func (*GhostElement) GetRange ¶ added in v0.3.0
func (g *GhostElement) GetRange(index int) Range
func (*GhostElement) GetRangeCount ¶ added in v0.3.0
func (g *GhostElement) GetRangeCount() int
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
Line is parts of buffer.
func (*Line) AppendString ¶
AppendString is appending string into tail.
func (*Line) GetContent ¶
GetContent is returns string of content.
func (*Line) InsertString ¶
InsertString is insert string into specified column.
func (*Line) PrependString ¶
PrependString is insert string into line ahead.
type PlainDocument ¶ added in v0.3.0
type PlainDocument struct {
// contains filtered or unexported fields
}
PlainDocument is wrapper of Buffer. track a current cursor position.
func (*PlainDocument) Clear ¶ added in v0.3.0
func (doc *PlainDocument) Clear()
Clear is initialize Buffer.
func (*PlainDocument) CreateTrack ¶ added in v0.3.0
func (doc *PlainDocument) CreateTrack(row int, bytePos int) *Track
func (*PlainDocument) GetLineBytes ¶ added in v0.3.0
func (doc *PlainDocument) GetLineBytes(index int) int
func (*PlainDocument) GetLineCount ¶ added in v0.3.0
func (doc *PlainDocument) GetLineCount() int
func (*PlainDocument) GetLineString ¶ added in v0.3.0
func (doc *PlainDocument) GetLineString(lineIndex int) string
func (*PlainDocument) GetVersion ¶ added in v0.3.0
func (doc *PlainDocument) GetVersion() uint
func (*PlainDocument) Init ¶ added in v0.3.0
func (doc *PlainDocument) Init()
Init is initialize Buffer.
func (*PlainDocument) InsertString ¶ added in v0.3.0
func (doc *PlainDocument) InsertString(row int, bytePos int, s string)
func (*PlainDocument) Read ¶ added in v0.3.0
func (doc *PlainDocument) Read(r Range) Segment
func (*PlainDocument) Remove ¶ added in v0.3.0
func (doc *PlainDocument) Remove(row int, bytePos int, byteLen int)
func (*PlainDocument) Render ¶ added in v0.3.0
func (doc *PlainDocument) Render() []Element
func (*PlainDocument) ReplaceAll ¶ added in v0.3.0
func (doc *PlainDocument) ReplaceAll(r io.Reader)
type PlainElement ¶ added in v0.3.0
type PlainElement struct {
Range Range
}
func (*PlainElement) GetElement ¶ added in v0.3.0
func (p *PlainElement) GetElement(index int) Element
func (*PlainElement) GetElementCount ¶ added in v0.3.0
func (p *PlainElement) GetElementCount() int
func (*PlainElement) GetRange ¶ added in v0.3.0
func (p *PlainElement) GetRange(index int) Range
func (*PlainElement) GetRangeCount ¶ added in v0.3.0
func (p *PlainElement) GetRangeCount() int
type Segment ¶ added in v0.3.0
type Segment interface {
// GetSpan returns span at specified line.
GetSpan(lineIndex int) Span
// GetLine returns string of line at specified line.
GetLine(lineIndex int) string
// GetLineCount returns line count.
GetLineCount() int
}
Segment is reference to multiline string.