Documentation ¶
Index ¶
- Constants
- Variables
- type Cell
- type Layout
- func (l *Layout) CellLocationForPoint(p *document.Point) (int, int, error)
- func (l *Layout) Document() *document.Document
- func (l *Layout) LineIterator(startLineIndex int) *LineIterator
- func (l *Layout) ScreenWidth() int
- func (l *Layout) SetDocument(d *document.Document)
- func (l *Layout) SetScreenWidth(screenWidth int)
- func (l *Layout) String() string
- type Line
- type LineIterator
- type Lines
- type ParagraphItem
- type ParagraphItemPenalty
- type ParagraphItemType
Constants ¶
View Source
const ( ParagraphItemTypeBox ParagraphItemType = 0 ParagraphItemTypeGlue = iota ParagraphItemTypePenalty = iota )
View Source
const ( ParagraphItemPenaltyNever ParagraphItemType = 1000 ParagraphItemPenaltyNeutral = 0 ParagraphItemPenaltyAlways = -1000 )
Variables ¶
View Source
var ( ErrPointIsFromDifferentDocument = errors.New("Point is from different document") ErrPointNotFound = errors.New("Point not found") )
View Source
var ( StyleNormal = tcell.StyleDefault.Background(tcell.ColorDarkBlue).Foreground(tcell.ColorLightGray) StyleMarkup = StyleNormal.Foreground(tcell.ColorDarkCyan) )
Functions ¶
This section is empty.
Types ¶
type Cell ¶
type Cell struct { // Mainc represents the main rune for this cell. If 0, the cell is the rightmost companion to a // wide character and should not be rendered. Mainc rune // Combc holds any combining runes for the cell. Combc []rune // Style describes how to render the cell. Style tcell.Style // StartOffset gives the location within the parent paragraph of the cell's contents. StartOffset int // EndOFfset gices the location within the parent just after the cell's contents. EndOffset int }
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
func (*Layout) CellLocationForPoint ¶
func (*Layout) LineIterator ¶
func (l *Layout) LineIterator(startLineIndex int) *LineIterator
func (*Layout) ScreenWidth ¶
func (*Layout) SetDocument ¶
func (*Layout) SetScreenWidth ¶
type LineIterator ¶
type LineIterator struct {
// contains filtered or unexported fields
}
func (*LineIterator) Done ¶
func (i *LineIterator) Done() bool
func (*LineIterator) Next ¶
func (i *LineIterator) Next() (int, Line)
type ParagraphItem ¶
type ParagraphItem struct { // Type represents the type of this layout item: box, glue or penalty. Type ParagraphItemType // Text is the content of this item when rendered on screen. Only applicable to boxes. Text string // Style is the appearance of this item when rendered on screen. Style tcell.Style // StartOffset is the lowest inclusive offset within the underlying paragraph represented by // this item. StartOffset int // EndOffset is the lowest offset within the underlying paragraph >= StartOffset which is not // represented by this item. EndOffset int // Penalty gives a penalty for breaking the line at this item. If the penalty is +ve, the line // will never be broken. If the penalty is 0, the line _may_ be broken. If the penalty is -ve // the line will always be broken. // // Only glue and penalties can break lines. Penalty is ignored for boxes. Penalty ParagraphItemPenalty }
ParagraphItem represents a layout item within a paragraph. Items may be boxes, glue or penalties.
Boxes are literal horizontal collections of Cells to be rendered. Glue are Cells which are rendered representing the space between words. Penalties represent explicit line-breaking opportunity points.
func (*ParagraphItem) CellCount ¶
func (p *ParagraphItem) CellCount() int
CellCount is the *minimum* number of on-screen cells required to represent the item. Glue, in particular, may be rendered with more cells.
type ParagraphItemPenalty ¶
type ParagraphItemPenalty int
type ParagraphItemType ¶
type ParagraphItemType int
Click to show internal directories.
Click to hide internal directories.