Documentation ¶
Overview ¶
Package termtext deals with monospace text as interpreted by terminals.
Index ¶
- Variables
- func AlignCenter(s string, w int) string
- func AlignLeft(s string, w int) string
- func AlignRight(s string, w int) string
- func Expand(s string) string
- func Slice(s string, start, stop int) string
- func Width(s string) int
- func WordWrap(s string, w int, prefix string) string
- func Wrap(s string, w int, prefix string) string
Constants ¶
This section is empty.
Variables ¶
var TabWidth = 8
Number of spaces to count a tab as.
Functions ¶
func AlignCenter ¶
AlignCenter centre-aligns a string, filling up any remaining width with spaces.
Tabs will be expanded to spaces.
func AlignLeft ¶
AlignLeft left-aligns a string, filling up any remaining width with spaces.
Tabs will be expanded to spaces.
func AlignRight ¶
AlignRight right-aligns a string, filling up any remaining width with spaces.
Tabs will be expanded to spaces.
func Slice ¶
Slice a string by character index. This works the same as str[n:m] slicing.
Tabs will be expanded to spaces.
func Width ¶
Width gets the display width of a string.
The "display width" is the number of columns a string will occupy in a monospace terminal.
func WordWrap ¶
WordWrap wraps lines to be at most w characters wide, but doesn't break in the middle of words.
Lines will be prefixed with prefix. The prefix isn't counted in line length calculations.
Tabs will be expanded to spaces.
Types ¶
This section is empty.