Documentation
¶
Overview ¶
Package srcview is a linked source's tab: a window of the source's rows drawn as a sheet with a frozen header row, the row numbers and a scrollbar over the whole source, however many millions of rows it has. The rows come from the Host a page at a time as the window moves (paged.Pages); rows on their way show as a dim ellipsis. The view owns the active cell and the scroll; the UI owns the rest.
Index ¶
- type Column
- type Hit
- type Host
- type View
- func (v *View) Active() (int64, int)
- func (v *View) Cell() (int64, sheet.LiveCell, bool)
- func (v *View) ColX(col int) int
- func (v *View) DragBar(y int)
- func (v *View) Draw() []string
- func (v *View) HitAt(x, y int) Hit
- func (v *View) Key(k tea.KeyPressMsg) bool
- func (v *View) Lines() int
- func (v *View) Move(rows int64, cols int)
- func (v *View) MoveTo(row int64, col int)
- func (v *View) Prefetch()
- func (v *View) Refit()
- func (v *View) Reset()
- func (v *View) Resize(width, height int)
- func (v *View) Scroll(d int64)
- func (v *View) ScrollBar(at, lines int)
- func (v *View) ScrollTo(top int64)
- func (v *View) Top() int64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hit ¶
type Hit struct {
Row int64
Col int
Cell bool
Bar bool
BarLines int // how many lines the scrollbar has, for ScrollBar
BarAt int // the line of the scrollbar hit
}
Hit is what the screen position x, y of the view is: a cell (its row and column), the scrollbar, or nothing.
type Host ¶
type Host interface {
Theme() *theme.Theme
Locale() *locale.Locale
// Columns are the source's columns, left to right.
Columns() []Column
// Rows counts the rows the tab shows, false while they're being
// counted (a sort or a filter being applied).
Rows() (int64, bool)
// Row is the tab's row i: its number in the source, counting from
// 0, and its values, false while its page is on its way.
Row(i int64) (int64, []sheet.LiveCell, bool)
// Want asks for the rows from through to.
Want(from, to int64)
}
Host is what the view needs of the UI.
type View ¶
type View struct {
// contains filtered or unexported fields
}
View is a source's tab.
func (*View) Cell ¶
Cell is the active cell's number in the source and value, with false while its row is on its way.
func (*View) ColX ¶
ColX is the screen column column col starts at, from the view's left edge: the row numbers' width when it isn't shown.
func (*View) DragBar ¶
DragBar moves the window to where the scrollbar's line at y (from the view's first line) stands for, as the thumb is dragged.
func (*View) Draw ¶
Draw draws the view's lines: the column letters, the header row of the columns' names, the divider under it, then the rows, the scrollbar at the right edge. It asks the host for the rows shown and a page either side, so scrolling finds them read.
func (*View) Key ¶
func (v *View) Key(k tea.KeyPressMsg) bool
Key moves the active cell as a sheet's keys do, reporting whether the key was the view's: the arrows, Page Up and Down, Home and End, and with Ctrl the data's edges, which on a source are its first and last rows and columns.
func (*View) Prefetch ¶
func (v *View) Prefetch()
Prefetch asks for the rows shown and a window's worth either side, so scrolling finds them read.
func (*View) Refit ¶
func (v *View) Refit()
Refit sizes the columns again once rows are read, as when the source is read again.
func (*View) Reset ¶
func (v *View) Reset()
Reset goes back to the first row, as when the rows are sorted or filtered again.
func (*View) Scroll ¶
Scroll moves the window d rows, leaving the active cell where it is unless it would leave the window.