ui

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2017 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package ui contains types that may be used by different editor frontends.

Index

Constants

View Source
const (
	F1 rune = -iota - 1
	F2
	F3
	F4
	F5
	F6
	F7
	F8
	F9
	F10
	F11
	F12

	Up
	Down
	Right
	Left

	Home
	Insert
	Delete
	End
	PageUp
	PageDown

	DefaultBindingRune // A special value to represent default binding.

	Tab       = '\t'
	Enter     = '\n'
	Backspace = 0x7f
)

Special negative runes to represent function keys, used in the Rune field of the Key struct.

Variables

View Source
var Default = Key{DefaultBindingRune, 0}

Default is used in the key binding table to indicate default binding.

View Source
var ErrKeyMustBeString = errors.New("key must be string")

Functions

func TranslateStyle added in v0.9.0

func TranslateStyle(s string) string

Types

type Key

type Key struct {
	Rune rune
	Mod  Mod
}

Key represents a single keyboard input, typically assembled from a escape sequence.

func ToKey

func ToKey(idx eval.Value) Key

ToKey converts an elvish String to a Key. If the passed Value is not a String, it throws an error.

func (Key) String

func (k Key) String() string

type Mod

type Mod byte

Mod represents a modifier key.

const (
	// Shift is the shift modifier. It is only applied to special keys (e.g.
	// Shift-F1). For instance 'A' and '@' which are typically entered with the
	// shift key pressed, are not considered to be shift-modified.
	Shift Mod = 1 << iota
	// Alt is the alt modifier, traditionally known as the meta modifier.
	Alt
	Ctrl
)

Values for Mod.

type Styled added in v0.9.0

type Styled struct {
	Text   string
	Styles Styles
}

Styled is a piece of text with style.

func Unstyled added in v0.9.0

func Unstyled(s string) Styled

func (*Styled) Kind added in v0.9.0

func (s *Styled) Kind() string

func (*Styled) Repr added in v0.9.0

func (s *Styled) Repr(indent int) string

func (*Styled) String added in v0.9.0

func (s *Styled) String() string

type Styles added in v0.9.0

type Styles []string

func JoinStyles added in v0.9.0

func JoinStyles(so Styles, st ...Styles) Styles

func StylesFromString added in v0.9.0

func StylesFromString(s string) Styles

func (Styles) String added in v0.9.0

func (s Styles) String() string

Jump to

Keyboard shortcuts

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