ui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2018 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteSliceGrow

func ByteSliceGrow(b []byte, newCap int) []byte

func ByteSliceInsert

func ByteSliceInsert(text []byte, offset int, what []byte) []byte

func ByteSliceRemove

func ByteSliceRemove(text []byte, from, to int) []byte

func Close

func Close() error

func Fill

func Fill(x, y, w, h int, cell termbox.Cell)

func KeyArrowDownHandler

func KeyArrowDownHandler(ui *UI, ch rune) error

func KeyArrowUpHandler

func KeyArrowUpHandler(ui *UI, ch rune) error

func KeyBackspace2Handler

func KeyBackspace2Handler(ui *UI, ch rune) error

func KeyBackspaceHandler

func KeyBackspaceHandler(ui *UI, ch rune) error

func KeyCtrlQHandler

func KeyCtrlQHandler(ui *UI, ch rune) error

func KeyDefaultHandler

func KeyDefaultHandler(ui *UI, ch rune) error

func KeyEnterHandler

func KeyEnterHandler(ui *UI, ch rune) error

func KeyEscHandler

func KeyEscHandler(ui *UI, ch rune) error

func KeySpaceHandler

func KeySpaceHandler(ui *UI, ch rune) error

func Open

func Open(sk []byte) error

func TBPrint

func TBPrint(x, y int, fg, bg termbox.Attribute, msg string)

Types

type EditBox

type EditBox struct {
	// 如果conf为nil, 将使用默认配置
	Conf *EditBoxConfig
	// contains filtered or unexported fields
}

func NewEditBox

func NewEditBox() *EditBox

func (*EditBox) DeleteRune

func (eb *EditBox) DeleteRune()

func (*EditBox) Drop

func (eb *EditBox) Drop() error

func (*EditBox) InsertRune

func (eb *EditBox) InsertRune(r rune)

func (*EditBox) Open

func (eb *EditBox) Open(ui *UI)

func (*EditBox) Value

func (eb *EditBox) Value() []byte

type EditBoxConfig

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

func DefaultEditBoxConfig

func DefaultEditBoxConfig() *EditBoxConfig

type KeyHandler

type KeyHandler func(ui *UI, ch rune) error

type ListBox

type ListBox struct {
	// 如果conf为nil, 将使用默认配置
	Conf *ListBoxConfig
	// contains filtered or unexported fields
}

func NewListBox

func NewListBox() *ListBox

func (*ListBox) Clear

func (lb *ListBox) Clear()

func (*ListBox) Close

func (lb *ListBox) Close()

func (*ListBox) CopySel

func (lb *ListBox) CopySel() error

xsel or xclip will be needed

func (*ListBox) Next

func (lb *ListBox) Next() error

func (*ListBox) NotifyMatch

func (lb *ListBox) NotifyMatch()

NotifyMatch: 告知ListBox编辑框的内容发生改变

func (*ListBox) Open

func (lb *ListBox) Open(ui *UI)

func (*ListBox) Prev

func (lb *ListBox) Prev() error

type ListBoxConfig

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

func DefaultListBoxConfig

func DefaultListBoxConfig() *ListBoxConfig

type Notify

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

func NewNotify

func NewNotify(msg string, duration time.Duration) *Notify

func (*Notify) Info

func (n *Notify) Info()

func (*Notify) Warn

func (n *Notify) Warn()

type UI

type UI struct {
	EditBox *EditBox
	ListBox *ListBox
	// contains filtered or unexported fields
}

func NewUI

func NewUI() *UI

func (*UI) Open

func (ui *UI) Open(sk []byte)

Jump to

Keyboard shortcuts

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