cellbuf

package module
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 17 Imported by: 2

Documentation

Overview

Package cellbuf provides terminal cell buffer functionality.

Index

Examples

Constants

View Source
const (
	NoUnderline     = ansi.NoUnderlineStyle
	SingleUnderline = ansi.SingleUnderlineStyle
	DoubleUnderline = ansi.DoubleUnderlineStyle
	CurlyUnderline  = ansi.CurlyUnderlineStyle
	DottedUnderline = ansi.DottedUnderlineStyle
	DashedUnderline = ansi.DashedUnderlineStyle
)

These are the available underline styles.

View Source
const DefaultTabInterval = 8

DefaultTabInterval is the default tab interval.

Variables

View Source
var (
	// BlankCell is a cell with a single space, width of 1, and no style or link.
	BlankCell = Cell{Rune: ' ', Width: 1}

	// EmptyCell is just an empty cell used for comparisons and as a placeholder
	// for wide cells.
	EmptyCell = Cell{}
)
View Source
var ErrInvalidDimensions = errors.New("invalid dimensions")

ErrInvalidDimensions is returned when the dimensions of a window are invalid for the operation.

View Source
var ErrOutOfBounds = errors.New("out of bounds")

ErrOutOfBounds is returned when the given x, y position is out of bounds.

Functions

func Clear

func Clear(s CellBuffer)

Clear clears the cell buffer with blank cells.

func ClearRect

func ClearRect(s CellBuffer, rect Rectangle)

ClearRect clears the rectangle within the cell buffer with blank cells.

func Fill

func Fill(s CellBuffer, c *Cell)

Fill fills the cell buffer with the given cell.

func FillRect

func FillRect(s CellBuffer, c *Cell, rect Rectangle)

FillRect fills the rectangle within the cell buffer with the given cell. This will not fill cells outside the bounds of the cell buffer.

func Height

func Height(s string) int

Height returns the height of a string.

func ReadLink(p []byte, link *Link)

ReadLink reads a hyperlink escape sequence from a data buffer.

func ReadStyle

func ReadStyle(params ansi.Params, pen *Style)

ReadStyle reads a Select Graphic Rendition (SGR) escape sequences from a list of parameters.

func ReadStyleColor

func ReadStyleColor(params ansi.Params, c *color.Color) int

ReadStyleColor reads a color from a list of parameters. See ansi.ReadStyleColor for more information.

func Render

func Render(d CellBuffer) string

Render returns a string representation of the grid with ANSI escape sequences.

func RenderLine

func RenderLine(d CellBuffer, n int) (w int, line string)

RenderLine returns a string representation of the yth line of the grid along with the width of the line.

func SetContent

func SetContent(s CellBuffer, str string)

SetContent clears the cell buffer with blank cells, and sets the given string as its content. If the height or width of the string exceeds the height or width of the cell buffer, it will be truncated.

func SetContentRect

func SetContentRect(s CellBuffer, str string, rect Rectangle)

SetContentRect clears the rectangle within the cell buffer with blank cells, and sets the given string as its content. If the height or width of the string exceeds the height or width of the cell buffer, it will be truncated.

func Wrap

func Wrap(s string, limit int, breakpoints string) string

Wrap returns a string that is wrapped to the specified limit applying any ANSI escape sequences in the string. It tries to wrap the string at word boundaries, but will break words if necessary.

The breakpoints string is a list of characters that are considered breakpoints for word wrapping. A hyphen (-) is always considered a breakpoint.

Note: breakpoints must be a string of 1-cell wide rune characters.

Example
fmt.Println(Wrap("The quick brown fox jumped over the lazy dog.", 20, ""))
Output:
The quick brown fox
jumped over the lazy
dog.

Types

type AttrMask

type AttrMask uint8

AttrMask is a bitmask for text attributes that can change the look of text. These attributes can be combined to create different styles.

const (
	BoldAttr AttrMask = 1 << iota
	FaintAttr
	ItalicAttr
	SlowBlinkAttr
	RapidBlinkAttr
	ReverseAttr
	ConcealAttr
	StrikethroughAttr

	ResetAttr AttrMask = 0
)

These are the available text attributes that can be combined to create different styles.

func (AttrMask) Contains

func (a AttrMask) Contains(attr AttrMask) bool

Contains returns whether the attribute mask contains the attribute.

type Buffer

type Buffer struct {
	// Lines holds the lines of the buffer.
	Lines []Line
}

Buffer is a 2D grid of cells representing a screen or terminal.

func NewBuffer

func NewBuffer(width int, height int) *Buffer

NewBuffer creates a new buffer with the given width and height. This is a convenience function that initializes a new buffer and resizes it.

func (*Buffer) Bounds

func (b *Buffer) Bounds() Rectangle

Bounds returns the bounds of the buffer.

func (*Buffer) Cell

func (b *Buffer) Cell(x int, y int) *Cell

Cell implements Screen.

func (*Buffer) Clear

func (b *Buffer) Clear()

Clear clears the buffer with space cells and rectangle.

func (*Buffer) ClearRect

func (b *Buffer) ClearRect(rect Rectangle)

ClearRect clears the buffer with space cells within the specified rectangles. Only cells within the rectangle's bounds are affected.

func (*Buffer) DeleteCell

func (b *Buffer) DeleteCell(x, y, n int, c *Cell)

DeleteCell deletes cells at the given position, with the given optional cell, within the specified rectangles. If no rectangles are specified, it deletes cells in the entire buffer. This follows terminal ansi.DCH behavior.

func (*Buffer) DeleteCellRect

func (b *Buffer) DeleteCellRect(x, y, n int, c *Cell, rect Rectangle)

DeleteCellRect deletes cells at the given position, with the given optional cell, within the rectangle bounds. Only cells within the rectangle's bounds are affected, following terminal ansi.DCH behavior.

func (*Buffer) DeleteLine

func (b *Buffer) DeleteLine(y, n int, c *Cell)

DeleteLine deletes n lines at the given line position, with the given optional cell, within the specified rectangles. If no rectangles are specified, it deletes lines in the entire buffer.

func (*Buffer) DeleteLineRect

func (b *Buffer) DeleteLineRect(y, n int, c *Cell, rect Rectangle)

DeleteLineRect deletes lines at the given line position, with the given optional cell, within the rectangle bounds. Only cells within the rectangle's bounds are affected. Lines are shifted up within the bounds and new blank lines are created at the bottom. This follows terminal ansi.DL behavior.

func (*Buffer) Fill

func (b *Buffer) Fill(c *Cell)

Fill fills the buffer with the given cell and rectangle.

func (*Buffer) FillRect

func (b *Buffer) FillRect(c *Cell, rect Rectangle)

FillRect fills the buffer with the given cell and rectangle.

func (*Buffer) Height

func (b *Buffer) Height() int

Height implements Screen.

func (*Buffer) InsertCell

func (b *Buffer) InsertCell(x, y, n int, c *Cell)

InsertCell inserts new cells at the given position, with the given optional cell, within the specified rectangles. If no rectangles are specified, it inserts cells in the entire buffer. This follows terminal ansi.ICH behavior.

func (*Buffer) InsertCellRect

func (b *Buffer) InsertCellRect(x, y, n int, c *Cell, rect Rectangle)

InsertCellRect inserts new cells at the given position, with the given optional cell, within the rectangle bounds. Only cells within the rectangle's bounds are affected, following terminal ansi.ICH behavior.

func (*Buffer) InsertLine

func (b *Buffer) InsertLine(y, n int, c *Cell)

InsertLine inserts n lines at the given line position, with the given optional cell, within the specified rectangles. If no rectangles are specified, it inserts lines in the entire buffer. Only cells within the rectangle's horizontal bounds are affected. Lines are pushed out of the rectangle bounds and lost. This follows terminal ansi.IL behavior. It returns the pushed out lines.

func (*Buffer) InsertLineRect

func (b *Buffer) InsertLineRect(y, n int, c *Cell, rect Rectangle)

InsertLineRect inserts new lines at the given line position, with the given optional cell, within the rectangle bounds. Only cells within the rectangle's horizontal bounds are affected. Lines are pushed out of the rectangle bounds and lost. This follows terminal ansi.IL behavior.

func (*Buffer) Line

func (b *Buffer) Line(y int) Line

Line returns a pointer to the line at the given y position. If the line does not exist, it returns nil.

func (*Buffer) Resize

func (b *Buffer) Resize(width int, height int)

Resize resizes the buffer to the given width and height.

func (*Buffer) SetCell

func (b *Buffer) SetCell(x, y int, c *Cell) bool

SetCell sets the cell at the given x, y position.

func (*Buffer) String

func (b *Buffer) String() (s string)

String returns the string representation of the buffer.

func (*Buffer) Width

func (b *Buffer) Width() int

Width implements Screen.

type Cell

type Cell struct {
	// The style of the cell. Nil style means no style. Zero value prints a
	// reset sequence.
	Style Style

	// Link is the hyperlink of the cell.
	Link Link

	// Comb is the combining runes of the cell. This is nil if the cell is a
	// single rune or if it's a zero width cell that is part of a wider cell.
	Comb []rune

	// Width is the mono-space width of the grapheme cluster.
	Width int

	// Rune is the main rune of the cell. This is zero if the cell is part of a
	// wider cell.
	Rune rune
}

Cell represents a single cell in the terminal screen.

func NewCell

func NewCell(r rune, comb ...rune) (c *Cell)

NewCell returns a new cell. This is a convenience function that initializes a new cell with the given content. The cell's width is determined by the content using runewidth.RuneWidth. This will only account for the first combined rune in the content. If the content is empty, it will return an empty cell with a width of 0.

func NewCellString

func NewCellString(s string) (c *Cell)

NewCellString returns a new cell with the given string content. This is a convenience function that initializes a new cell with the given content. The cell's width is determined by the content using runewidth.StringWidth. This will only use the first combined rune in the string. If the string is empty, it will return an empty cell with a width of 0.

func NewGraphemeCell

func NewGraphemeCell(s string) (c *Cell)

NewGraphemeCell returns a new cell. This is a convenience function that initializes a new cell with the given content. The cell's width is determined by the content using uniseg.FirstGraphemeClusterInString. This is used when the content is a grapheme cluster i.e. a sequence of runes that form a single visual unit. This will only return the first grapheme cluster in the string. If the string is empty, it will return an empty cell with a width of 0.

func (*Cell) Append

func (c *Cell) Append(r ...rune)

Append appends runes to the cell without changing the width. This is useful when we want to use the cell to store escape sequences or other runes that don't affect the width of the cell.

func (*Cell) Blank

func (c *Cell) Blank() *Cell

Blank makes the cell a blank cell by setting the rune to a space, comb to nil, and the width to 1.

func (*Cell) Clear

func (c *Cell) Clear() bool

Clear returns whether the cell consists of only attributes that don't affect appearance of a space character.

func (*Cell) Clone

func (c *Cell) Clone() (n *Cell)

Clone returns a copy of the cell.

func (Cell) Empty

func (c Cell) Empty() bool

Empty returns whether the cell is an empty cell. An empty cell is a cell with a width of 0, a rune of 0, and no combining runes.

func (*Cell) Equal

func (c *Cell) Equal(o *Cell) bool

Equal returns whether the cell is equal to the other cell.

func (*Cell) Reset

func (c *Cell) Reset()

Reset resets the cell to the default state zero value.

func (Cell) String

func (c Cell) String() string

String returns the string content of the cell excluding any styles, links, and escape sequences.

type CellBuffer

type CellBuffer interface {
	// Cell returns the cell at the given position.
	Cell(x, y int) *Cell
	// SetCell sets the cell at the given position to the given cell. It
	// returns whether the cell was set successfully.
	SetCell(x, y int, c *Cell) bool
	// Bounds returns the bounds of the cell buffer.
	Bounds() Rectangle
}

CellBuffer is a cell buffer that represents a set of cells in a screen or a grid.

type Cursor

type Cursor struct {
	Style
	Link
	Position
}

Cursor represents a terminal Cursor.

type Line

type Line []*Cell

Line represents a line in the terminal. A nil cell represents an blank cell, a cell with a space character and a width of 1. If a cell has no content and a width of 0, it is a placeholder for a wide cell.

func (Line) At

func (l Line) At(x int) *Cell

At returns the cell at the given x position. If the cell does not exist, it returns nil.

func (Line) Len

func (l Line) Len() int

Len returns the length of the line.

func (Line) Set

func (l Line) Set(x int, c *Cell) bool

Set sets the cell at the given x position. If a wide cell is given, it will set the cell and the following cells to EmptyCell. It returns true if the cell was set.

func (Line) String

func (l Line) String() (s string)

String returns the string representation of the line. Any trailing spaces are removed.

func (Line) Width

func (l Line) Width() int

Width returns the width of the line.

type Link struct {
	URL    string
	Params string
}

Link represents a hyperlink in the terminal screen.

func ConvertLink(h Link, p colorprofile.Profile) Link

ConvertLink converts a hyperlink to respect the given color profile.

func (Link) Empty

func (h Link) Empty() bool

Empty returns whether the hyperlink is empty.

func (*Link) Equal

func (h *Link) Equal(o *Link) bool

Equal returns whether the hyperlink is equal to the other hyperlink.

func (*Link) Reset

func (h *Link) Reset()

Reset resets the hyperlink to the default state zero value.

func (Link) String

func (h Link) String() string

String returns a string representation of the hyperlink.

type PenWriter

type PenWriter struct {
	// contains filtered or unexported fields
}

PenWriter is a writer that writes to a buffer and keeps track of the current pen style and link state for the purpose of wrapping with newlines.

func NewPenWriter

func NewPenWriter(w io.Writer) *PenWriter

NewPenWriter returns a new PenWriter.

func (*PenWriter) Close

func (w *PenWriter) Close() error

Close closes the writer, resets the style and link if necessary, and releases its parser. Calling it is performance critical, but forgetting it does not cause safety issues or leaks.

func (w *PenWriter) Link() Link

Link returns the current pen link.

func (*PenWriter) Style

func (w *PenWriter) Style() Style

Style returns the current pen style.

func (*PenWriter) Write

func (w *PenWriter) Write(p []byte) (int, error)

Write writes to the buffer.

type Position

type Position = image.Point

Position represents an x, y position.

func Pos

func Pos(x, y int) Position

Pos is a shorthand for Position{X: x, Y: y}.

type Rectangle

type Rectangle = image.Rectangle

Rectangle represents a rectangle.

func Rect

func Rect(x, y, w, h int) Rectangle

Rect is a shorthand for Rectangle.

type Screen

type Screen struct {
	// contains filtered or unexported fields
}

Screen represents the terminal screen.

func NewScreen

func NewScreen(w io.Writer, width, height int, opts *ScreenOptions) (s *Screen)

NewScreen creates a new Screen.

func (*Screen) Bounds

func (s *Screen) Bounds() Rectangle

Bounds implements Window.

func (*Screen) Cell

func (s *Screen) Cell(x int, y int) *Cell

Cell implements Window.

func (*Screen) Clear

func (s *Screen) Clear() bool

Clear clears the screen with blank cells. This is a convenience method for Screen.Fill with a nil cell.

func (*Screen) ClearRect

func (s *Screen) ClearRect(r Rectangle) bool

ClearRect clears the given rectangle with blank cells. This is a convenience method for Screen.FillRect with a nil cell.

func (*Screen) Close

func (s *Screen) Close() (err error)

Close writes the final screen update and resets the screen.

func (*Screen) EnterAltScreen

func (s *Screen) EnterAltScreen()

EnterAltScreen enters the alternate screen buffer.

func (*Screen) ExitAltScreen

func (s *Screen) ExitAltScreen()

ExitAltScreen exits the alternate screen buffer.

func (*Screen) Fill

func (s *Screen) Fill(cell *Cell) bool

Fill implements Window.

func (*Screen) FillRect

func (s *Screen) FillRect(cell *Cell, r Rectangle) bool

FillRect implements Window.

func (*Screen) Flush

func (s *Screen) Flush() (err error)

Flush flushes the buffer to the screen.

func (*Screen) Height

func (s *Screen) Height() int

Height returns the height of the screen.

func (*Screen) HideCursor

func (s *Screen) HideCursor()

HideCursor hides the cursor.

func (*Screen) InsertAbove

func (s *Screen) InsertAbove(str string)

InsertAbove inserts string above the screen. The inserted string is not managed by the screen. This does nothing when alternate screen mode is enabled.

func (*Screen) MoveTo

func (s *Screen) MoveTo(x, y int)

MoveTo moves the cursor to the given position.

func (*Screen) Redraw

func (s *Screen) Redraw()

Redraw forces a full redraw of the screen.

func (*Screen) Render

func (s *Screen) Render()

Render renders changes of the screen to the internal buffer. Call Screen.Flush to flush pending changes to the screen.

func (*Screen) Resize

func (s *Screen) Resize(width, height int) bool

Resize resizes the screen.

func (*Screen) SetCell

func (s *Screen) SetCell(x int, y int, cell *Cell) (v bool)

SetCell implements Window.

func (*Screen) SetColorProfile

func (s *Screen) SetColorProfile(p colorprofile.Profile)

SetColorProfile sets the color profile to use when writing to the screen.

func (*Screen) SetMethod

func (s *Screen) SetMethod(method ansi.Method)

SetMethod sets the method used to calculate the width of cells.

func (*Screen) SetRelativeCursor

func (s *Screen) SetRelativeCursor(v bool)

SetRelativeCursor sets whether to use relative cursor movements.

func (*Screen) ShowCursor

func (s *Screen) ShowCursor()

ShowCursor shows the cursor.

func (*Screen) UseBackspaces

func (s *Screen) UseBackspaces(v bool)

UseBackspaces sets whether to use backspace characters to move the cursor.

func (*Screen) UseHardTabs

func (s *Screen) UseHardTabs(v bool)

UseHardTabs sets whether to use hard tabs to optimize cursor movements.

func (*Screen) Width

func (s *Screen) Width() int

Width returns the width of the screen.

type ScreenOptions

type ScreenOptions struct {
	// Term is the terminal type to use when writing to the screen. When empty,
	// `$TERM` is used from [os.Getenv].
	Term string
	// Profile is the color profile to use when writing to the screen.
	Profile colorprofile.Profile
	// RelativeCursor is whether to use relative cursor movements. This is
	// useful when alt-screen is not used or when using inline mode.
	RelativeCursor bool
	// AltScreen is whether to use the alternate screen buffer.
	AltScreen bool
	// ShowCursor is whether to show the cursor.
	ShowCursor bool
	// HardTabs is whether to use hard tabs to optimize cursor movements.
	HardTabs bool
	// Backspace is whether to use backspace characters to move the cursor.
	Backspace bool
	// MapNL whether we have ONLCR mapping enabled. When we set the terminal to
	// raw mode, the ONLCR mode gets disabled. ONLCR maps any newline/linefeed
	// (`\n`) character to carriage return + line feed (`\r\n`).
	MapNL bool
}

ScreenOptions are options for the screen.

type ScreenWriter

type ScreenWriter struct {
	*Screen
}

ScreenWriter represents a writer that writes to a Screen parsing ANSI escape sequences and Unicode characters and converting them into cells that can be written to a cell Buffer.

func NewScreenWriter

func NewScreenWriter(s *Screen) *ScreenWriter

NewScreenWriter creates a new ScreenWriter that writes to the given Screen. This is a convenience function for creating a ScreenWriter.

func (*ScreenWriter) Print

func (s *ScreenWriter) Print(str string, v ...any)

Print prints the string at the current cursor position. It will wrap the string to the width of the screen if it exceeds the width of the screen. This will recognize ANSI ansi.SGR style and ansi.SetHyperlink escape sequences.

func (*ScreenWriter) PrintAt

func (s *ScreenWriter) PrintAt(x, y int, str string, v ...any)

PrintAt prints the string at the given position. It will wrap the string to the width of the screen if it exceeds the width of the screen. This will recognize ANSI ansi.SGR style and ansi.SetHyperlink escape sequences.

func (*ScreenWriter) PrintCrop

func (s *ScreenWriter) PrintCrop(str string, tail string)

PrintCrop prints the string at the current cursor position and truncates the text if it exceeds the width of the screen. Use tail to specify a string to append if the string is truncated. This will recognize ANSI ansi.SGR style and ansi.SetHyperlink escape sequences.

func (*ScreenWriter) PrintCropAt

func (s *ScreenWriter) PrintCropAt(x, y int, str string, tail string)

PrintCropAt prints the string at the given position and truncates the text if it exceeds the width of the screen. Use tail to specify a string to append if the string is truncated. This will recognize ANSI ansi.SGR style and ansi.SetHyperlink escape sequences.

func (*ScreenWriter) SetContent

func (s *ScreenWriter) SetContent(str string)

SetContent clears the screen with blank cells, and sets the given string as its content. If the height or width of the string exceeds the height or width of the screen, it will be truncated.

This will recognize ANSI ansi.SGR style and ansi.SetHyperlink escape sequences.

func (*ScreenWriter) SetContentRect

func (s *ScreenWriter) SetContentRect(str string, rect Rectangle)

SetContentRect clears the rectangle within the screen with blank cells, and sets the given string as its content. If the height or width of the string exceeds the height or width of the screen, it will be truncated.

This will recognize ANSI ansi.SGR style and ansi.SetHyperlink escape sequences.

func (*ScreenWriter) Write

func (s *ScreenWriter) Write(p []byte) (n int, err error)

Write writes the given bytes to the screen. This will recognize ANSI ansi.SGR style and ansi.SetHyperlink escape sequences.

type Style

type Style struct {
	Fg      ansi.Color
	Bg      ansi.Color
	Ul      ansi.Color
	Attrs   AttrMask
	UlStyle UnderlineStyle
}

Style represents the Style of a cell.

func ConvertStyle

func ConvertStyle(s Style, p colorprofile.Profile) Style

ConvertStyle converts a style to respect the given color profile.

func (*Style) Background

func (s *Style) Background(c ansi.Color) *Style

Background sets the background color.

func (*Style) Bold

func (s *Style) Bold(v bool) *Style

Bold sets the bold attribute.

func (*Style) Clear

func (s *Style) Clear() bool

Clear returns whether the style consists of only attributes that don't affect appearance of a space character.

func (*Style) Conceal

func (s *Style) Conceal(v bool) *Style

Conceal sets the conceal attribute.

func (Style) DiffSequence

func (s Style) DiffSequence(o Style) string

DiffSequence returns the ANSI sequence that sets the style as a diff from another style.

func (*Style) Empty

func (s *Style) Empty() bool

Empty returns true if the style is empty.

func (*Style) Equal

func (s *Style) Equal(o *Style) bool

Equal returns true if the style is equal to the other style.

func (*Style) Faint

func (s *Style) Faint(v bool) *Style

Faint sets the faint attribute.

func (*Style) Foreground

func (s *Style) Foreground(c ansi.Color) *Style

Foreground sets the foreground color.

func (*Style) Italic

func (s *Style) Italic(v bool) *Style

Italic sets the italic attribute.

func (s *Style) RapidBlink(v bool) *Style

RapidBlink sets the rapid blink attribute.

func (*Style) Reset

func (s *Style) Reset() *Style

Reset resets the style to default.

func (*Style) Reverse

func (s *Style) Reverse(v bool) *Style

Reverse sets the reverse attribute.

func (Style) Sequence

func (s Style) Sequence() string

Sequence returns the ANSI sequence that sets the style.

func (s *Style) SlowBlink(v bool) *Style

SlowBlink sets the slow blink attribute.

func (*Style) Strikethrough

func (s *Style) Strikethrough(v bool) *Style

Strikethrough sets the strikethrough attribute.

func (*Style) Underline

func (s *Style) Underline(v bool) *Style

Underline sets the underline attribute. This is a syntactic sugar for UnderlineStyle.

func (*Style) UnderlineColor

func (s *Style) UnderlineColor(c ansi.Color) *Style

UnderlineColor sets the underline color.

func (*Style) UnderlineStyle

func (s *Style) UnderlineStyle(style UnderlineStyle) *Style

UnderlineStyle sets the underline style.

type TabStops

type TabStops struct {
	// contains filtered or unexported fields
}

TabStops represents horizontal line tab stops.

func DefaultTabStops

func DefaultTabStops(cols int) *TabStops

DefaultTabStops creates a new set of tab stops with the default interval.

func NewTabStops

func NewTabStops(width, interval int) *TabStops

NewTabStops creates a new set of tab stops from a number of columns and an interval.

func (*TabStops) Clear

func (ts *TabStops) Clear()

Clear removes all tab stops.

func (TabStops) Find

func (ts TabStops) Find(col, delta int) int

Find returns the prev/next tab stop before/after the given column and delta. If delta is positive, it returns the next tab stop after the given column. If delta is negative, it returns the previous tab stop before the given column. If delta is zero, it returns the given column.

func (TabStops) IsStop

func (ts TabStops) IsStop(col int) bool

IsStop returns true if the given column is a tab stop.

func (TabStops) Next

func (ts TabStops) Next(col int) int

Next returns the next tab stop after the given column.

func (TabStops) Prev

func (ts TabStops) Prev(col int) int

Prev returns the previous tab stop before the given column.

func (*TabStops) Reset

func (ts *TabStops) Reset(col int)

Reset removes the tab stop at the given column.

func (*TabStops) Resize

func (ts *TabStops) Resize(width int)

Resize resizes the tab stops to the given width.

func (*TabStops) Set

func (ts *TabStops) Set(col int)

Set adds a tab stop at the given column.

type UnderlineStyle

type UnderlineStyle = ansi.UnderlineStyle

UnderlineStyle is the style of underline to use for text.

Source Files

  • buffer.go
  • cell.go
  • errors.go
  • geom.go
  • hardscroll.go
  • hashmap.go
  • link.go
  • pen.go
  • screen.go
  • sequence.go
  • style.go
  • tabstop.go
  • utils.go
  • wrap.go
  • writer.go

Jump to

Keyboard shortcuts

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