ui

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultKeyMap = KeyMap{
	SelectPrevMessage: key.NewBinding(
		key.WithKeys("up"),
		key.WithHelp("↑", "move up")),
	SelectNextMessage: key.NewBinding(
		key.WithKeys("down"),
		key.WithHelp("↓", "move down"),
	),

	UnfocusMessage: key.NewBinding(
		key.WithKeys("esc", "ctrl+g"),
		key.WithHelp("esc", "unfocus message"),
	),
	FocusMessage: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "focus message"),
	),

	SubmitMessage: key.NewBinding(
		key.WithKeys("tab"),
		key.WithHelp("tab", "submit message"),
	),
	CancelCompletion: key.NewBinding(
		key.WithKeys("esc", "ctrl+g"),
		key.WithHelp("esc", "cancel completion"),
	),

	DismissError: key.NewBinding(
		key.WithKeys("esc", "ctrl+g"),
		key.WithHelp("esc", "dismiss error"),
	),

	SaveToFile: key.NewBinding(
		key.WithKeys("ctrl+s"),
		key.WithHelp("ctrl+s", "save to file"),
	),
	SaveSourceBlocksToFile: key.NewBinding(
		key.WithKeys("ctrl+shift+s"),
		key.WithHelp("ctrl+shift+s", "save source blocks to file"),
	),

	CopyToClipboard: key.NewBinding(
		key.WithKeys("ctrl+c"),
		key.WithHelp("ctrl+c", "copy to clipboard"),
	),
	CopyLastResponseToClipboard: key.NewBinding(
		key.WithKeys("ctrl+shift+d"),
		key.WithHelp("ctrl+shift+d", "copy last response to clipboard"),
	),
	CopySourceBlocksToClipboard: key.NewBinding(
		key.WithKeys("ctrl+shift+c"),
		key.WithHelp("ctrl+shift+c", "copy source blocks to clipboard"),
	),

	ScrollUp: key.NewBinding(
		key.WithKeys("shift+pgup"),
		key.WithHelp("shift+pgup", "scroll up"),
	),
	ScrollDown: key.NewBinding(
		key.WithKeys("shift+pgdown"),
		key.WithHelp("shift+pgdown", "scroll down"),
	),

	Quit: key.NewBinding(
		key.WithKeys("ctrl+c"),
		key.WithHelp("ctrl+c", "quit"),
	),
}

Functions

func InitialModel

func InitialModel(manager *context.Manager, step chat.Step) model

func OpenTTY

func OpenTTY() (io.ReadWriteCloser, error)

Types

type BorderColors

type BorderColors struct {
	Unselected string
	Selected   string
	Focused    string
}

type KeyMap

type KeyMap struct {
	SelectPrevMessage key.Binding
	SelectNextMessage key.Binding
	UnfocusMessage    key.Binding
	FocusMessage      key.Binding
	SubmitMessage     key.Binding
	ScrollUp          key.Binding
	ScrollDown        key.Binding

	CancelCompletion key.Binding
	DismissError     key.Binding

	LoadFromFile key.Binding

	SaveToFile             key.Binding
	SaveSourceBlocksToFile key.Binding

	CopyToClipboard             key.Binding
	CopyLastResponseToClipboard key.Binding
	CopySourceBlocksToClipboard key.Binding

	Help key.Binding
	Quit key.Binding
}

func (KeyMap) FullHelp added in v0.2.24

func (k KeyMap) FullHelp() [][]key.Binding

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

type State added in v0.2.24

type State string
const (
	StateUserInput        State = "user_input"
	StateMovingAround     State = "moving_around"
	StateStreamCompletion State = "stream_completion"
	StateError            State = "error"
)

type StreamCompletionError added in v0.2.24

type StreamCompletionError struct {
	Err error
}

type StreamCompletionMsg added in v0.2.24

type StreamCompletionMsg struct {
	Completion string
}

type StreamDoneMsg added in v0.2.24

type StreamDoneMsg struct {
}

type Style

type Style struct {
	UnselectedMessage lipgloss.Style
	SelectedMessage   lipgloss.Style
	FocusedMessage    lipgloss.Style
}

func DefaultStyles

func DefaultStyles() *Style

Jump to

Keyboard shortcuts

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