ui

package
v0.0.0-...-70c1726 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 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

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

type Styled struct {
	Text   string
	Styles Styles
}

Styled is a piece of text with style.

func Unstyled

func Unstyled(s string) Styled

func (*Styled) Kind

func (s *Styled) Kind() string

func (*Styled) Repr

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

func (*Styled) String

func (s *Styled) String() string

type Styles

type Styles []string

func JoinStyles

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

func StylesFromString

func StylesFromString(s string) Styles

func (Styles) String

func (s Styles) String() string

Jump to

Keyboard shortcuts

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