Documentation
¶
Index ¶
- Constants
- Variables
- func PrevLine(bx B) bool
- type B
- type Box
- type Run
- func (f *Run) Add(bn, n int)
- func (r *Run) Boxscan(s []byte, ymax int)
- func (f *Run) Chop(b *Box, n int)
- func (f *Run) Close(n0, n1 int)
- func (f *Run) Colof(bn int) (coln, xmax int)
- func (f *Run) Combine(g *Run, n int)
- func (f *Run) Count(nb int) int64
- func (f *Run) Delete(n0, n1 int)
- func (f *Run) DumpBoxes()
- func (f *Run) Dup(bn int)
- func (f *Run) EndCell(bn int) int
- func (f *Run) EndLine(bn int) int
- func (f *Run) Find(bn int, p, q int64) int
- func (f *Run) Findcol(bn int, coln int) (cbn int, xmax int)
- func (f *Run) Free(n0, n1 int)
- func (f *Run) Grow(delta int)
- func (f *Run) Merge(bn int)
- func (f *Run) NextCell(bn int) int
- func (f *Run) NextLine(bn int) int
- func (f *Run) PrevLine(bn int) int
- func (f *Run) Reset(ft font.Face)
- func (r *Run) Runescan(s []byte, ymax int)
- func (f *Run) Split(bn, n int)
- func (f *Run) StartCell(bn int) int
- func (f *Run) StartLine(bn int) int
- func (f *Run) Stretch(nb int) (pb int)
- func (f *Run) Stretch2(nb int, bx []Box) (pb int)
- func (b Run) String() string
- func (f *Run) Truncate(b *Box, n int)
Constants ¶
const SLOP = 25
Variables ¶
var MaxBytes = 256 + 3
MaxBytes is the largest capacity of bytes in a box
Functions ¶
Types ¶
type Run ¶
type Run struct { Box []Box Nalloc int Nbox int Face font.Face Nchars int64 Nlines int // contains filtered or unexported fields }
Run is a one-dimensional field of boxes. It can scan arbitrary text into boxes with Bxscan().
func (*Run) Count ¶
Count recomputes and returns the number of bytes stored between box nb and the last box
func (*Run) Find ¶
Find finds the box containing q starting from box bn index p and puts q at the start of the next box
func (*Run) NextCell ¶
NextCell is like EndCell, except it doesn't assume bn is part of a cell. It skips past the current cell under bn and any non-cellular boxes afterward, returning the starting box of the next cell or f.Nbox
func (*Run) Reset ¶
Reset resets all boxes in the run without deallocating their data on the heap. If widthfn is not nill, it becomes the new measuring function for the run. Boxes in the run are not remeasured upon reset.
func (*Run) Stretch ¶
Elastic tabstop experiment section. Not ready for general use by any means the text/tabwriter package implements elastic tabstops, but that package assumes that all chars are the same width and that text needs to be rescanned.
The frame already distinguishes between tabs, newlines, and plain text characters by encapsulating them in measured boxes. A direct copy of the tabwriter code would ignore the datastructures in the frame and their sublinear runtime cost.
The current elastic algorithm has suboptimal runtime performance