text: import "github.com/elves/elvish/pkg/cli/term"
  Package term provides functionality for working with terminals.
  buffer.go buffer_builder.go event.go file_reader_unix.go read_rune.go reader.go reader_unix.go setup.go setup_unix.go term.go writer.go
  DotHere is a special argument to MarkLines to mark the position of the dot.
  ErrStopped is returned by Reader when Close is called during a ReadEvent or ReadRawEvent method.
  BuffersHeight computes the combined height of a number of buffers.
  CellsWidth returns the total width of a Cell slice.
  CompareCells returns whether two Cell slices are equal, and when they are not, the first index at which they differ.
  IsReadErrorRecoverable returns whether an error returned by Reader is recoverable.
  Sanitize sanitizes the terminal after an external command has executed.
  Setup sets up the terminal so that it is suitable for the Reader and Writer to use. It returns a function that can be used to restore the original terminal config.
  SetupGlobal sets up the terminal for the entire Elvish session.
  type Buffer struct { Width int // Lines the content of the buffer. Lines Lines // Dot is what the user perceives as the cursor. Dot Pos }
  Buffer reflects a continuous range of lines on the terminal.
  The Unix terminal API provides only awkward ways of querying the terminal Buffer, so we keep an internal reflection and do one-way synchronizations (Buffer -> terminal, and not the other way around). This requires us to exactly match the terminal's idea of the width of characters (wcwidth) and where to insert soft carriage returns, so there could be bugs.
  NewBuffer builds a new buffer, with one empty line.
  Buffer returns itself.
  Col returns the column the cursor is in.
  Cursor returns the current position of the cursor.
  Extend adds all lines from b2 to the bottom of this buffer. If moveDot is true, the dot is updated to match the dot of b2.
  ExtendRight extends bb to the right. It pads each line in b to be b.Width and appends the corresponding line in b2 to it, making new lines when b2 has more lines than bb.
  TTYString returns a string for representing the buffer on the terminal.
  TrimToLines trims a buffer to the lines [low, high).
  type BufferBuilder struct { Width, Col, Indent int // EagerWrap controls whether to wrap line as soon as the cursor reaches the // right edge of the terminal. This is not often desirable as it creates // unneessary line breaks, but is is useful when echoing the user input. // will otherwise EagerWrap bool // Lines the content of the buffer. Lines [][]Cell // Dot is what the user perceives as the cursor. Dot Pos }
  BufferBuilder supports building of Buffer.
  func NewBufferBuilder(width int) *BufferBuilder
  NewBufferBuilder makes a new BufferBuilder, initially with one empty line.
  func (bb *BufferBuilder) Buffer() *Buffer
  Buffer returns a Buffer built by the BufferBuilder.
  func (bb *BufferBuilder) Cursor() Pos
  func (bb *BufferBuilder) MarkLines(args ...interface{}) *BufferBuilder
  MarkLines is like calling WriteStyled with ui.MarkLines(args...), but accepts an additional special parameter DotHere to mark the position of the dot.
  func (bb *BufferBuilder) Newline() *BufferBuilder
  Newline starts a newline.
  func (bb *BufferBuilder) SetDotHere() *BufferBuilder
  func (bb *BufferBuilder) SetEagerWrap(v bool) *BufferBuilder
  func (bb *BufferBuilder) SetIndent(indent int) *BufferBuilder
  func (bb *BufferBuilder) SetLines(lines ...[]Cell) *BufferBuilder
  func (bb *BufferBuilder) Write(text string, ts ...ui.Styling) *BufferBuilder
  Write is equivalent to calling WriteStyled with ui.T(text, style...).
  func (bb *BufferBuilder) WriteRuneSGR(r rune, style string) *BufferBuilder
  WriteRuneSGR writes a single rune to a buffer with an SGR style, wrapping the line when needed. If the rune is a control character, it will be written using the caret notation (like ^X) and gets the additional style of styleForControlChar.
  func (bb *BufferBuilder) WriteSpaces(w int, ts ...ui.Styling) *BufferBuilder
  WriteSpaces writes w spaces with the given styles.
  func (bb *BufferBuilder) WriteStringSGR(text, style string) *BufferBuilder
  WriteStringSGR writes a string to a buffer with a SGR style.
  func (bb *BufferBuilder) WriteStyled(t ui.Text) *BufferBuilder
  WriteStyled writes a styled text.
  Cell is an indivisible unit on the screen. It is not necessarily 1 column wide.
  CursorPosition represents a report of the current cursor position from the terminal driver, usually as a response from a cursor position request.
  Event represents an event that can be read from the terminal.
  FatalErrorEvent represents an error that affects the Reader's ability to continue reading events. After sending a FatalError, the Reader makes no more attempts at continuing to read events and wait for Stop to be called.
  KeyEvent represents a key press.
  K constructs a new KeyEvent.
  Line stores a single line.
  Lines stores multiple lines.
  type MouseEvent struct { Pos Down bool // Number of the Button, 0-based. -1 for unknown. Button int Mod ui.Mod }
  MouseEvent represents a mouse event (either pressing or releasing).
  NonfatalErrorEvent represents an error that can be gradually recovered. After sending a NonfatalError, the Reader will continue to read events. Note that one anamoly in the terminal might cause multiple NonfatalError events to be sent.
  PasteSetting indicates the start or finish of pasted text.
  Pos is a line/column position.
  type Reader interface { // ReadEvent reads a single event from the terminal. ReadEvent() (Event, error) // ReadRawEvent reads a single raw event from the terminal. The concept of // raw events is applicable where terminal events are represented as escape // sequences sequences, such as most modern Unix terminal emulators. If // the concept is not applicable, such as in the Windows console, it is // equivalent to ReadEvent. ReadRawEvent() (Event, error) // Close releases resources associated with the Reader. Any outstanding // ReadEvent or ReadRawEvent call will be aborted, returning ErrStopped. Close() }
  Reader reads events from the terminal.
  NewReader creates a new Reader on the given terminal file.
  TODO: NewReader should return an error as well. Right now failure to initialize Reader panics.
  type Writer interface { // CurrentBuffer returns the current buffer. CurrentBuffer() *Buffer // ResetCurrentBuffer resets the current buffer. ResetCurrentBuffer() // CommitBuffer updates the terminal display to reflect current buffer. CommitBuffer(bufNoti, buf *Buffer, fullRefresh bool) error }
  Package term imports 13 packages (graph) and is imported by 11 packages. Updated 2020-02-15. Refresh now. Tools for package owners.