termwin

package module
v0.0.0-...-4f5ba36 Latest Latest
Warning

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

Go to latest
Published: May 17, 2018 License: BSD-2-Clause, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClipboardClear

func ClipboardClear()

ClipboardClear clears the current contents of the clipboard.

func ClipboardGet

func ClipboardGet() string

ClipboardGet returns the current contents of the clipboard

func ClipboardSet

func ClipboardSet(s string)

ClipboardSet sets the contents of the clipboard.

func Close

func Close()

Close shuts down the termwin system.

func CreateLog

func CreateLog(filename string)

CreateLog creates a new file for log output.

func Flush

func Flush()

Flush flushes the contents of the back buffer to the screen display.

func Init

func Init() error

Init must be called before any termwin controls can be used.

func Logf

func Logf(format string, args ...interface{})

Logf logs a formatted line of text to the log output file.

func Logln

func Logln(s string)

Logln logs a newline-terminated string to the log output file.

func Poll

func Poll() error

Poll polls the system for an input event

func SetFocus

func SetFocus(w Window)

SetFocus removes the cursor focus from any window it is currently on and adds focus to the specified window. If you pass nil for the window, SetFocus removes focus from all windows.

func Size

func Size() (x, y int)

Size returns the current dimensions of the screen.

Types

type EditBox

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

An EditBox represents a editable area of text on the screen. Many common text editing controls are allowed within an EditBox: cursor movement, character insertion and deleteion, text selection, copy/cut/paste, etc.

func NewEditBox

func NewEditBox(x, y, width, height int, flags EditBoxFlags) *EditBox

NewEditBox creates a new EditBox control with the specified screen position and size.

func (*EditBox) Contents

func (b *EditBox) Contents() string

Contents returns the entire contents of the edit buffer.

func (*EditBox) CopyToClipboard

func (b *EditBox) CopyToClipboard()

CopyToClipboard copies the current selection to the clipboard.

func (*EditBox) Cursor

func (b *EditBox) Cursor() (x, y int)

Cursor returns the cursor's current column and row within the edit buffer.

func (*EditBox) CursorDown

func (b *EditBox) CursorDown()

CursorDown moves the cursor down a line.

func (*EditBox) CursorEndOfBuffer

func (b *EditBox) CursorEndOfBuffer()

CursorEndOfBuffer moves the cursor to the end of the edit buffer.

func (*EditBox) CursorEndOfLine

func (b *EditBox) CursorEndOfLine()

CursorEndOfLine moves the cursor to the end of the current line.

func (*EditBox) CursorLeft

func (b *EditBox) CursorLeft()

CursorLeft moves the cursor left, shifting to the end of the previous line if the cursor is at column 0.

func (*EditBox) CursorPageDown

func (b *EditBox) CursorPageDown()

CursorPageDown moves the cursor down a page.

func (*EditBox) CursorPageUp

func (b *EditBox) CursorPageUp()

CursorPageUp moves the cursor up a page.

func (*EditBox) CursorRight

func (b *EditBox) CursorRight()

CursorRight moves the cursor right, shifting to the next line if the cursor is at the right-most column of the current line.

func (*EditBox) CursorSet

func (b *EditBox) CursorSet(x, y int)

CursorSet sets the position of the cursor within the edit buffer. Negative values position the cursor relative to the last column and row of the buffer. A value of -1 for x indicates the end of the row. A value of -1 for y indicates the last row.

func (*EditBox) CursorStartOfBuffer

func (b *EditBox) CursorStartOfBuffer()

CursorStartOfBuffer moves the cursor to the start of the edit buffer.

func (*EditBox) CursorStartOfLine

func (b *EditBox) CursorStartOfLine()

CursorStartOfLine moves the cursor to the start of the current line.

func (*EditBox) CursorUp

func (b *EditBox) CursorUp()

CursorUp moves the cursor up a line.

func (*EditBox) CursorWordEnd

func (b *EditBox) CursorWordEnd()

CursorWordEnd moves the cursor to end of the word.

func (*EditBox) CursorWordStart

func (b *EditBox) CursorWordStart()

CursorWordStart moves the cursor to the start of the word.

func (*EditBox) CutToClipboard

func (b *EditBox) CutToClipboard()

CutToClipboard copies the current selection to the clipboard and then deletes it from the edit buffer.

func (*EditBox) DeleteChar

func (b *EditBox) DeleteChar()

DeleteChar deletes a single character at the current cursor position.

func (*EditBox) DeleteCharLeft

func (b *EditBox) DeleteCharLeft()

DeleteCharLeft deletes the character to the left of the cursor and moves the cursor to the position of the deleted character. If the cursor is at the start of the line, the newline is removed.

func (*EditBox) DeleteChars

func (b *EditBox) DeleteChars(n int)

DeleteChars deletes multiple characters starting from the current cursor position.

func (*EditBox) DeleteRow

func (b *EditBox) DeleteRow()

DeleteRow deletes the entire row containing the cursor.

func (*EditBox) Draw

func (b *EditBox) Draw()

Draw updates the contents of the EditBox on the screen.

func (*EditBox) InsertChar

func (b *EditBox) InsertChar(ch rune)

InsertChar inserts a new character at the current cursor position and advances the cursor by one column.

func (*EditBox) InsertRow

func (b *EditBox) InsertRow()

InsertRow inserts a new row at the current cursor position. The cursor moves to the beginning of the inserted row.

func (*EditBox) InsertString

func (b *EditBox) InsertString(s string)

InsertString inserts an entire string at the current cursor position and advances the cursor by the length of the string.

func (*EditBox) LastRow

func (b *EditBox) LastRow() int

LastRow returns the row number of the last row in the buffer.

func (*EditBox) PasteFromClipboard

func (b *EditBox) PasteFromClipboard()

PasteFromClipboard pastes the current clipboard contents to the edit buffer at the current cursor position.

func (*EditBox) Selection

func (b *EditBox) Selection() string

Selection returns the contents of the substring currently selected in the edit buffer.

func (*EditBox) SetView

func (b *EditBox) SetView(x, y int)

SetView adjusts the buffer position currently representing the top-left corner of the visible EditBox.

func (*EditBox) Size

func (b *EditBox) Size() (width, height int)

Size returns the width and height of the EditBox on screen.

func (*EditBox) View

func (b *EditBox) View() (x, y int)

View returns the buffer position currently representing the top-left corner of the visible EditBox.

func (*EditBox) Write

func (b *EditBox) Write(p []byte) (n int, err error)

Write the contents of a UTF8-formatted buffer starting at the current cursor position. This function allows you to use standard formatted output functions like `fmt.Fprintf` with an EditBox control.

type EditBoxFlags

type EditBoxFlags byte

EditBoxFlags define settings for an EditBox.

const (
	// EditBoxWordWrap causes the edit box to word-wrap a line of text when
	// its length reaches the right edge of the screen.
	EditBoxWordWrap EditBoxFlags = 1 << iota
)

type Window

type Window interface {
	// contains filtered or unexported methods
}

A Window is an instance of a termwin control.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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