Categorygithub.com/jumpycalm/mview
modulepackage
0.0.0-20241006055333-3331c7ac4c99
Repository: https://github.com/jumpycalm/mview.git
Documentation: pkg.go.dev

# README

cview - Terminal-based user interface toolkit

GoDoc Donate via LiberaPay Donate via Patreon

This package is a fork of tview. See FORK.md for more information.

Demo

ssh cview.rocketnine.space -p 20000

Recording of presentation demo

Features

Available widgets:

  • Input forms (including input/password fields, drop-down selections, checkboxes, and buttons)
  • Navigable multi-color text views
  • Selectable lists with context menus
  • Modal dialogs
  • Horizontal and vertical progress bars
  • Grid, Flexbox and tabbed panel layouts
  • Sophisticated navigable table views
  • Flexible tree views
  • Draggable and resizable windows
  • An application wrapper

Widgets may be customized and extended to suit any application.

Mouse support is available.

Applications

A list of applications powered by cview is available via pkg.go.dev.

Installation

go get code.rocketnine.space/tslocum/cview

Hello World

This basic example creates a TextView titled "Hello, World!" and displays it in your terminal:

package main

import (
	"code.rocketnine.space/tslocum/cview"
)

func main() {
	app := cview.NewApplication()

	tv := cview.NewTextView()
	tv.SetBorder(true)
	tv.SetTitle("Hello, world!")
	tv.SetText("Lorem ipsum dolor sit amet")
	
	app.SetRoot(tv, true)
	if err := app.Run(); err != nil {
		panic(err)
	}
}

Examples are available via godoc and in the demos directory.

For a presentation highlighting the features of this package, compile and run the program in the demos/presentation directory.

Documentation

Package documentation is available via godoc.

An introduction tutorial is also available.

Dependencies

This package is based on github.com/gdamore/tcell (and its dependencies) and github.com/rivo/uniseg.

Support

CONTRIBUTING.md describes how to share issues, suggestions and patches (pull requests).

# Packages

No description provided by the author

# Functions

ANSIWriter returns an io.Writer which translates any ANSI escape codes written to it into mview color tags.
ColorHex returns the hexadecimal value of a color as a string, prefixed with #.
Escape escapes the given text such that color and/or region tags are not recognized and substituted by the print functions of this package.
EscapeBytes escapes the given text such that color and/or region tags are not recognized and substituted by the print functions of this package.
HitShortcut returns whether the EventKey provided is present in one or more sets of keybindings.
NewApplication creates and returns a new application.
NewBox returns a Box without a border.
NewButton returns a new input field.
NewCheckBox returns a new input field.
NewContextMenu returns a new context menu.
NewDropDown returns a new drop-down.
NewDropDownOption returns a new option for a dropdown.
NewFlex returns a new flexbox layout container with no primitives and its direction set to FlexColumn.
NewFocusManager returns a new FocusManager object.
NewForm returns a new form.
NewFrame returns a new frame around the given primitive.
NewGrid returns a new grid-based layout container with no initial primitives.
NewInputField returns a new input field.
NewList returns a new form.
NewListItem returns a new item for a list.
NewModal returns a new centered message window.
NewPages returns a new Panels object.
NewPanels returns a new Panels object.
NewProgressBar returns a new progress bar.
NewSlider returns a new slider.
NewTabbedPanels returns a new TabbedPanels object.
NewTable returns a new table.
NewTableCell returns a new table cell with sensible defaults.
NewTextView returns a new text view.
NewTreeNode returns a new tree node.
NewTreeView returns a new tree view.
NewWindow returns a new window around the given primitive.
NewWindowManager returns a new window manager.
Print prints text onto the screen into the given box at (x,y,maxWidth,1), not exceeding that box.
PrintJoinedSemigraphics prints a semigraphics rune into the screen at the given position with the given color, joining it with any existing semigraphics rune.
PrintSimple prints white text to the screen at the given position.
PrintStyle works like Print() but it takes a style instead of just a foreground color.
RenderScrollBar renders a scroll bar at the specified position.
SetAttributes sets attributes on a style.
StripTags returns the provided text without color and/or region tags.
TaggedStringWidth returns the width of the given string needed to print it on screen.
TaggedTextWidth returns the width of the given string needed to print it on screen.
TranslateANSI replaces ANSI escape sequences found in the provided string with mview's color tags and returns the resulting string.
WordWrap splits a text such that each resulting line does not exceed the given screen width.

# Constants

Vertical alignment within a box.
Horizontal alignment within a box.
Horizontal alignment within a box.
Vertical alignment within a box.
Horizontal alignment within a box.
Vertical alignment within a box.
╦.
╗.
╔.
═.
╩.
╝.
╚.
║.
╬.
╣.
╠.
╥.
╖.
╓.
┟.
┰.
┒.
┧.
┎.
╁.
┑.
┍.
┡.
┯.
┨.
╇.
╤.
╕.
╒.
╍.
╏.
╻.
┳.
┓.
┏.
━.
╸.
╾.
┉.
┋.
╺.
┅.
┇.
╹.
┻.
┛.
╿.
┗.
┃.
╋.
┫.
┣.
╅.
┭.
┵.
┽.
┲.
┺.
╊.
╃.
╮.
╭.
╯.
╰.
╳.
╲.
╱.
╌.
╎.
╷.
┬.
┐.
┌.
─.
╴.
╼.
┈.
┊.
╶.
┄.
┆.
╵.
╽.
┴.
┘.
└.
│.
┼.
┤.
├.
╆.
┮.
┶.
┾.
┱.
┹.
╉.
╄.
╜.
╨.
╙.
╀.
┸.
┦.
┚.
┞.
┖.
╈.
┷.
┪.
┙.
┢.
┕.
╧.
╛.
╘.
╫.
╢.
╟.
╂.
┨.
┠.
┿.
┥.
┝.
╪.
╡.
╞.
Configuration values.
Configuration values.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
ScrollBarAlways always shows a scroll bar.
ScrollBarAuto shows a scroll bar when there are items offscreen.
ScrollBarNever never shows a scroll bar.
….
StandardDoubleClick is a commonly used double click interval.
Widget transformations.
Widget transformations.
Widget transformations.
Widget transformations.
Widget transformations.
Widget transformations.

# Variables

Borders defines various borders used when primitives are drawn.
ColorUnset represents an unset color.
DefaultFormFieldWidth is the default field screen width of form elements whose field width is flexible (0).
InputFieldFloat accepts floating-point numbers.
InputFieldInteger accepts integers.
InputFieldMaxLength returns an input field accept handler which accepts input strings up to a given length.
Keys defines the keyboard shortcuts of an application.
Scroll bar render text (must be one cell wide).
Scroll bar render text (must be one cell wide).
Scroll bar render text (must be one cell wide).
Scroll bar render text (must be one cell wide).
SemigraphicJoints is a map for joining semigraphic (or otherwise) runes.
Styles defines the appearance of an application.
TabSize is the number of spaces with which a tab character will be replaced.
TrueColorTags is a flag which controls whether color tags should render as the specific colors defined by tcell, or as the colors defined by the user's terminal configuration (the default).

# Structs

Application represents the top node of an application.
Box is the base Primitive for all widgets.
Button is labeled box that triggers an action when selected.
CheckBox implements a simple box for boolean values which can be checked and unchecked.
ContextMenu is a menu that appears upon user interaction, such as right clicking or pressing Alt+Enter.
DropDown implements a selection widget whose options become visible in a drop-down list when activated.
DropDownOption is one option that can be selected in a drop-down primitive.
Flex is a basic implementation of the Flexbox layout.
FocusManager manages application focus.
Form allows you to combine multiple one-line form elements into a vertical or horizontal layout.
FormItemAttributes is a set of attributes to be applied.
Frame is a wrapper which adds space around another primitive.
Grid is an implementation of a grid-based layout.
InputField is a one-line box (three lines if there is a title) where the user can enter text.
Key defines the keyboard shortcuts of an application.
List displays rows of items, each of which can be selected.
ListItem represents an item in a List.
Modal is a centered message window used to inform the user or prompt them for an immediate decision.
Pages is a wrapper around Panels.
Panels is a container for other primitives often used as the application's root primitive.
ProgressBar indicates the progress of an operation.
Slider is a progress bar which may be modified via keyboard and mouse.
TabbedPanels is a tabbed container for other primitives.
Table visualizes two-dimensional data consisting of rows and columns.
TableCell represents one cell inside a Table.
TextView is a box which displays text.
Theme defines the colors used when primitives are initialized.
TreeNode represents one node in a tree view.
TreeView displays tree structures.
Window is a draggable, resizable frame around a primitive.
WindowManager provides an area which windows may be added to.

# Interfaces

Focusable provides a method which determines if a primitive has focus.
FormItem is the interface all form items must implement to be able to be included in a form.
Primitive is the top-most interface for all graphical primitives.

# Type aliases

MouseAction indicates one of the actions the mouse is logically doing.
ScrollBarVisibility specifies the display of a scroll bar.
Transformation describes a widget state modification.
VerticalAlignment represents vertical alignment.