tabstrip

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package tabstrip is the sheet tabs at the left of the status line, the way tmux lists windows: the sheet shown is highlighted, a + adds a sheet, and when the tabs don't all fit, ‹ and › step through them. It lays the strip out and remembers where each sheet was left; what a click on it does is the UI's (showing, renaming, moving a sheet are commands). It needs no host: the UI hands it a View.

Index

Constants

View Source
const NotebookMark = "❯ "

NotebookMark starts a notebook tab's label, so it reads apart from the sheets' without color.

Variables

This section is empty.

Functions

func Label

func Label(s *sheet.Sheet) string

Label is a sheet's name as its tab shows it, a notebook's after its mark, with the mark of its linked regions, if it has any.

func Mark added in v0.3.0

func Mark(paused, failed bool) string

Mark is the glyph that shows how a linked region follows its file: ● following, ‖ paused, ! when the file can't be read. It reads without color.

Types

type Kind

type Kind int

Kind is a part of the strip.

const (
	None Kind = iota
	Tab       // a sheet's tab
	Add       // the + after the tabs
	Prev      // the ‹ before tabs scrolled off to the left
	Next      // the › after tabs scrolled off to the right
)

type Place

type Place struct {
	Cur       sheet.Addr
	Top, Left int
}

Place is where a sheet's cursor and scroll position were when it was last shown.

type Span

type Span struct {
	Kind  Kind
	Index int // the sheet, for Tab
	X, W  int
}

Span is a clickable part of the strip, at x on the status line.

type Strip

type Strip struct {
	Places map[*sheet.Sheet]Place // where each sheet's cursor and scroll were left
	// contains filtered or unexported fields
}

Strip is the sheet tabs' state: where each sheet was left, and how far the strip is scrolled.

func (*Strip) Layout

func (t *Strip) Layout(th *theme.Theme, v View, room int) (string, []Span)

Layout lays out the tabs in room columns: as many as fit, always the shown one, the first shown staying put until the shown one would fall off, ‹ and › where tabs are hidden, then the +.

type View

type View struct {
	Sheets []*sheet.Sheet
	Active int
	// Hover is the part under the mouse, and HoverIndex the tab for Tab.
	Hover      Kind
	HoverIndex int
	// Busy is set while the mouse drags something other than a tab, so
	// passing over a tab doesn't highlight it.
	Busy bool
}

View is what the strip shows: the sheets, the one shown, and what the mouse is over.

func (View) FullWidth

func (v View) FullWidth() int

FullWidth is how wide the strip is with every tab showing.

func (View) MinWidth

func (v View) MinWidth() int

MinWidth is the narrowest the strip gets: the shown sheet's tab, the arrows and the +.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL