app

package
v0.0.0-...-288b91b Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Bottom               = -1
	Top                  = 1
	Left                 = 1
	Right                = -1
	ActionBarMaxItems    = 10
	ActionBarItemPadding = 1
	MessageLabelNone     = "-"
)
View Source
const (
	FPS             = 30
	FPSMilliseconds = time.Second / FPS
)
View Source
const (
	Yes          = 'y'
	No           = 'n'
	QuestionMark = "? "
)
View Source
const (
	ResultsMarginBottom     = 3
	WriteIndicator          = "> "
	MaxResults              = 4096
	DefaultSupplierDebounce = 50 * time.Millisecond
	SearchResultsPivot      = 6
)
View Source
const (
	EmptyLine = ""
)

Variables

This section is empty.

Functions

func ActionBarLabel

func ActionBarLabel(str string) string

func ClampInt

func ClampInt(v, min, max int) int

func Color

func Color(c string) tcell.Color

func Confirm

func Confirm(app *App, message string) bool

func CurrentScreenName

func CurrentScreenName() string

func DefaultStyle

func DefaultStyle() tcell.Style

func DrawBox

func DrawBox(screen tcell.Screen, x1, y1, x2, y2 int, style tcell.Style)

func DrawText

func DrawText(screen tcell.Screen, x, y int, style tcell.Style, text string)

func DrawTextLimited

func DrawTextLimited(s tcell.Screen, x1, y1, x2, y2 int, style tcell.Style, text string) int

func Error

func Error(message string)

func GoBack

func GoBack()

func GoTo

func GoTo(name string, args ...interface{})

GoTo it's not a perfect solution ... but it's the only one that works, and not lead into cycled-import errors. For example, you can go from projects view into issues view, and from issues view into projects view. Both views are in different packages therefor it leas to cyclic-import

func MaxInt

func MaxInt(x, y int) int

func MinInt

func MinInt(x, y int) int

func MustLoadColorScheme

func MustLoadColorScheme() map[string]interface{}
func OpenLink(url string)

func PreviousScreenName

func PreviousScreenName() string

func RegisterGoto

func RegisterGoto(name string, f func(args ...interface{}))

func Success

func Success(message string)

Types

type ActionBar

type ActionBar struct {
	Action chan ActionBarAction
	Y      int
	X      int
	// contains filtered or unexported fields
}

func NewActionBar

func NewActionBar(vAlign int, hAlign int) *ActionBar

func (*ActionBar) AddItem

func (b *ActionBar) AddItem(item *ActionBarItem)

func (*ActionBar) AddItemWithStyles

func (b *ActionBar) AddItemWithStyles(text1 string, text2 string, text1Style tcell.Style, text2Style tcell.Style)

func (*ActionBar) AddTextItem

func (b *ActionBar) AddTextItem(id string, text string)

func (*ActionBar) Clear

func (b *ActionBar) Clear()

func (*ActionBar) Destroy

func (b *ActionBar) Destroy()

func (*ActionBar) Draw

func (b *ActionBar) Draw(screen tcell.Screen)

func (*ActionBar) GetItem

func (b *ActionBar) GetItem(index int) *ActionBarItem

func (*ActionBar) HandleKeyEvent

func (b *ActionBar) HandleKeyEvent(ev *tcell.EventKey)

func (*ActionBar) RemoveItem

func (b *ActionBar) RemoveItem(id int)

func (*ActionBar) RemoveItemAtIndex

func (b *ActionBar) RemoveItemAtIndex(index int)

func (*ActionBar) Resize

func (b *ActionBar) Resize(screenX, screenY int)

func (*ActionBar) TrimItemsTo

func (b *ActionBar) TrimItemsTo(index int)

func (*ActionBar) Update

func (b *ActionBar) Update()

type ActionBarAction

type ActionBarAction int

type ActionBarItem

type ActionBarItem struct {
	Id          int
	Text1       string
	Text2       string
	Text1Style  tcell.Style
	Text2Style  tcell.Style
	TriggerRune rune
	TriggerKey  tcell.Key
	// contains filtered or unexported fields
}

func NewActionBarItem

func NewActionBarItem(id int, text string, triggerRune rune, triggerKey tcell.Key) *ActionBarItem

func (*ActionBarItem) ChangeText

func (b *ActionBarItem) ChangeText(text1 string, text2 string)

func (*ActionBarItem) ChangeText2

func (b *ActionBarItem) ChangeText2(text2 string)

type App

type App struct {
	ScreenX int
	ScreenY int
	// contains filtered or unexported fields
}

func CreateNewApp

func CreateNewApp() *App

func CreateNewAppWithScreen

func CreateNewAppWithScreen(screen tcell.Screen) *App

CreateNewAppWithScreen accessible for testing

func GetApp

func GetApp() *App

func InitTestApp

func InitTestApp(s tcell.SimulationScreen) *App

func (*App) AddDrawable

func (a *App) AddDrawable(drawable Drawable)

func (*App) AddFlash

func (a *App) AddFlash(flash Drawable, duration time.Duration)

func (*App) AddSystem

func (a *App) AddSystem(system System)

func (*App) ClearNow

func (a *App) ClearNow()

func (*App) Close

func (a *App) Close()

func (*App) CurrentView

func (a *App) CurrentView() interface{}

func (*App) IsLoading

func (a *App) IsLoading() bool

func (*App) IsQuit

func (a *App) IsQuit() bool

func (*App) KeepAlive

func (a *App) KeepAlive(component interface{})

func (*App) LastDrawable

func (a *App) LastDrawable() Drawable

func (*App) Loading

func (a *App) Loading(flag bool)

func (*App) LoadingWithText

func (a *App) LoadingWithText(flag bool, text string)

func (*App) PanicRecover

func (a *App) PanicRecover()

func (*App) Quit

func (a *App) Quit()

func (*App) RemoveDrawable

func (a *App) RemoveDrawable(drawable Drawable)

func (*App) RemoveSystem

func (a *App) RemoveSystem(system System)

func (*App) Render

func (a *App) Render()

func (*App) RunOnAppRoutine

func (a *App) RunOnAppRoutine(f func())

func (*App) SetDirty

func (a *App) SetDirty()

func (*App) SetView

func (a *App) SetView(view View)

func (*App) Start

func (a *App) Start()

func (*App) UnKeepAlive

func (a *App) UnKeepAlive(component interface{})

type Confirmation

type Confirmation struct {
	Complete chan bool
	// contains filtered or unexported fields
}

func (*Confirmation) Draw

func (c *Confirmation) Draw(screen tcell.Screen)

func (*Confirmation) HandleKeyEvent

func (c *Confirmation) HandleKeyEvent(ev *tcell.EventKey)

func (*Confirmation) Resize

func (c *Confirmation) Resize(screenX, screenY int)

func (*Confirmation) Update

func (c *Confirmation) Update()

type Drawable

type Drawable interface {
	Draw(screen tcell.Screen)
}

type FuzzyFind

type FuzzyFind struct {
	MarginTop    int
	MarginBottom int
	Complete     chan FuzzyFindResult
	// contains filtered or unexported fields
}

func NewFuzzyFind

func NewFuzzyFind(title string, records []string) *FuzzyFind

func NewFuzzyFindWithProvider

func NewFuzzyFindWithProvider(title string, recordsProvider func(query string) []string) *FuzzyFind

func (*FuzzyFind) AlwaysShowAllResults

func (f *FuzzyFind) AlwaysShowAllResults()

func (*FuzzyFind) Draw

func (f *FuzzyFind) Draw(screen tcell.Screen)

func (*FuzzyFind) ForceUpdate

func (f *FuzzyFind) ForceUpdate()

func (*FuzzyFind) GetQuery

func (f *FuzzyFind) GetQuery() string

func (*FuzzyFind) GetSelectedItem

func (f *FuzzyFind) GetSelectedItem() string

func (*FuzzyFind) HandleKeyEvent

func (f *FuzzyFind) HandleKeyEvent(ev *tcell.EventKey)

func (*FuzzyFind) Resize

func (f *FuzzyFind) Resize(screenX, screenY int)

func (*FuzzyFind) SetDebounceDisabled

func (f *FuzzyFind) SetDebounceDisabled(b bool)

func (*FuzzyFind) SetDebounceMs

func (f *FuzzyFind) SetDebounceMs(d time.Duration)

func (*FuzzyFind) SetQuery

func (f *FuzzyFind) SetQuery(q string)

func (*FuzzyFind) Update

func (f *FuzzyFind) Update()

type FuzzyFindResult

type FuzzyFindResult struct {
	Index int
	Match string
}

type KeyListener

type KeyListener interface {
	HandleKeyEvent(keyEvent *tcell.EventKey)
}

type Resizable

type Resizable interface {
	Resize(screenX, screenY int)
}

type SpinnerTCell

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

func NewSimpleSpinner

func NewSimpleSpinner() *SpinnerTCell

func (*SpinnerTCell) Draw

func (t *SpinnerTCell) Draw(screen tcell.Screen)

type System

type System interface {
	Update()
}

type Text

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

func NewText

func NewText(x, y int, style tcell.Style, text string) *Text

func (*Text) ChangeText

func (t *Text) ChangeText(newText string)

func (*Text) Draw

func (t *Text) Draw(screen tcell.Screen)

type TextBox

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

func NewTextBox

func NewTextBox(x, y int, style tcell.Style, borderStyle tcell.Style, text string) *TextBox

func (*TextBox) Draw

func (t *TextBox) Draw(screen tcell.Screen)

func (*TextBox) SetText

func (t *TextBox) SetText(text string)

func (*TextBox) SetX

func (t *TextBox) SetX(x int)

func (*TextBox) SetY

func (t *TextBox) SetY(y int)

type View

type View interface {
	Init()
	Destroy()
}

Jump to

Keyboard shortcuts

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