buffers

package
v0.0.0-...-299fdb3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ACTION_LINE_BUFFER_ID = 4
View Source
const DIALOG_BUFFER_ID = 3
View Source
const DialogButtonsSpacing = 2
View Source
const DialogHorizontalPadding = 5
View Source
const DialogVerticalPadding = 2
View Source
const RECENT_TESTS_BUFFER_ID = 5
View Source
const STATS_BUFFER_ID = 6
View Source
const STATUS_LINE_BUFFER_ID = 2
View Source
const TYPING_BUFFER_IDENTIFIER = 1

Variables

This section is empty.

Functions

func GetTypingTestBufferPositionAndSize

func GetTypingTestBufferPositionAndSize(s tcell.Screen) (screen.BufferPosition, screen.BufferSize)

Types

type ActionsLineBuffer

type ActionsLineBuffer struct {
	TypingTestRepository db.Repository[db.TypingTestModel]
	// contains filtered or unexported fields
}

func NewActionsLineBuffer

func NewActionsLineBuffer(typingTestRepository db.Repository[db.TypingTestModel]) *ActionsLineBuffer

func (*ActionsLineBuffer) Draw

func (b *ActionsLineBuffer) Draw()

func (*ActionsLineBuffer) GetID

func (b *ActionsLineBuffer) GetID() int

func (*ActionsLineBuffer) HandleKeyEvent

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

func (*ActionsLineBuffer) SetScreen

func (b *ActionsLineBuffer) SetScreen(s tcell.Screen)

func (*ActionsLineBuffer) SetWindow

func (b *ActionsLineBuffer) SetWindow(w *screen.Window)

type ActionsLineMenu

type ActionsLineMenu interface {
	GetKey() tcell.Key
}

type ActionsLineMenuSwitch

type ActionsLineMenuSwitch struct {
	Label    string
	Selected bool
	Key      tcell.Key
	OnChange func(bool, *ActionsLineBuffer)
}

func (*ActionsLineMenuSwitch) GetKey

func (s *ActionsLineMenuSwitch) GetKey() tcell.Key

type DialogBuffer

type DialogBuffer struct {
	Title       string
	Description []StyledText
	Buttons     []DialogButton

	TitleStyle       tcell.Style
	DescriptionStyle tcell.Style
	// contains filtered or unexported fields
}

func (DialogBuffer) Draw

func (b DialogBuffer) Draw()

func (DialogBuffer) GetID

func (_ DialogBuffer) GetID() int

func (DialogBuffer) HandleKeyEvent

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

func (*DialogBuffer) SetScreen

func (b *DialogBuffer) SetScreen(s tcell.Screen)

func (*DialogBuffer) SetWindow

func (b *DialogBuffer) SetWindow(w *screen.Window)

type DialogButton

type DialogButton struct {
	Label  string
	Key    tcell.Key
	Style  tcell.Style
	Action func() bool
}

type RecentTestsBuffer

type RecentTestsBuffer struct {
	Size        screen.BufferSize
	Position    screen.BufferPosition
	Repository  db.Repository[db.TypingTestModel]
	RecentTests []db.TypingTestModel

	MinSpeed    float32
	MaxSpeed    float32
	MinAccuracy float32
	MaxAccuracy float32
	// contains filtered or unexported fields
}

func NewRecentTestsBuffer

func NewRecentTestsBuffer(position screen.BufferPosition, size screen.BufferSize, repository db.Repository[db.TypingTestModel]) RecentTestsBuffer

func (RecentTestsBuffer) Draw

func (b RecentTestsBuffer) Draw()

func (*RecentTestsBuffer) GetID

func (_ *RecentTestsBuffer) GetID() int

func (*RecentTestsBuffer) HandleKeyEvent

func (b *RecentTestsBuffer) HandleKeyEvent(_ *tcell.EventKey)

func (*RecentTestsBuffer) SetScreen

func (b *RecentTestsBuffer) SetScreen(s tcell.Screen)

func (*RecentTestsBuffer) SetWindow

func (b *RecentTestsBuffer) SetWindow(w *screen.Window)

func (*RecentTestsBuffer) Update

func (b *RecentTestsBuffer) Update()

type Stat

type Stat struct {
	Key   string
	Value any
}

func (Stat) FormatValue

func (s Stat) FormatValue(format string) string

type StatsBuffer

type StatsBuffer struct {
	Repository db.Repository[db.TypingTestModel]

	Position screen.BufferPosition
	Size     screen.BufferSize

	TestsCount         Stat
	SecondsSpentTyping Stat
	BestSpeed          Stat
	BestAccuracy       Stat
	WordsCount         Stat
	AvgSpeed           Stat
	AvgAccuracy        Stat
	// contains filtered or unexported fields
}

func NewStatsBuffer

func NewStatsBuffer(position screen.BufferPosition, size screen.BufferSize, repository db.Repository[db.TypingTestModel]) StatsBuffer

func (StatsBuffer) Draw

func (b StatsBuffer) Draw()

func (StatsBuffer) GetID

func (_ StatsBuffer) GetID() int

func (*StatsBuffer) HandleKeyEvent

func (b *StatsBuffer) HandleKeyEvent(_ *tcell.EventKey)

func (*StatsBuffer) SetScreen

func (b *StatsBuffer) SetScreen(s tcell.Screen)

func (*StatsBuffer) SetWindow

func (b *StatsBuffer) SetWindow(w *screen.Window)

func (*StatsBuffer) Update

func (b *StatsBuffer) Update()

type StatusLineBuffer

type StatusLineBuffer struct {
	Speed    float32
	Accuracy float32
	// contains filtered or unexported fields
}

func NewStatusLineBuffer

func NewStatusLineBuffer() StatusLineBuffer

func (StatusLineBuffer) Draw

func (b StatusLineBuffer) Draw()

func (StatusLineBuffer) GetID

func (b StatusLineBuffer) GetID() int

func (StatusLineBuffer) HandleKeyEvent

func (statuslinebuffer StatusLineBuffer) HandleKeyEvent(_ *tcell.EventKey)

func (*StatusLineBuffer) SetScreen

func (b *StatusLineBuffer) SetScreen(s tcell.Screen)

func (*StatusLineBuffer) SetWindow

func (b *StatusLineBuffer) SetWindow(w *screen.Window)

type StyledText

type StyledText struct {
	Text  string
	Style tcell.Style
}

type TestBufferMenuItem

type TestBufferMenuItem struct {
	Label  string
	Key    tcell.Key
	Action func(*TypingTestBuffer)
}

type TestMode

type TestMode int
const (
	TestMode25Words   TestMode = 0
	TestMode50Words   TestMode = 1
	TestMode75Words   TestMode = 2
	TestMode100Words  TestMode = 3
	TestMode15Seconds TestMode = 4
	TestMode30Seconds TestMode = 5
	TestMode45Seconds TestMode = 6
	TestMode60Seconds TestMode = 7
)

type TypingEvent

type TypingEvent struct {
	Time time.Time
	Key  *tcell.EventKey
}

type TypingTestBuffer

type TypingTestBuffer struct {
	Size     screen.BufferSize
	Position screen.BufferPosition

	Mode       TestMode
	Repository db.Repository[db.TypingTestModel]
	// contains filtered or unexported fields
}

func NewTypingTestBuffer

func NewTypingTestBuffer(position screen.BufferPosition, size screen.BufferSize, mode TestMode, repository db.Repository[db.TypingTestModel]) TypingTestBuffer

func (*TypingTestBuffer) Draw

func (b *TypingTestBuffer) Draw()

func (*TypingTestBuffer) GetID

func (b *TypingTestBuffer) GetID() int

func (*TypingTestBuffer) HandleKeyEvent

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

func (*TypingTestBuffer) Replay

func (b *TypingTestBuffer) Replay()

func (*TypingTestBuffer) SetScreen

func (b *TypingTestBuffer) SetScreen(screen tcell.Screen)

func (*TypingTestBuffer) SetWindow

func (b *TypingTestBuffer) SetWindow(w *screen.Window)

Jump to

Keyboard shortcuts

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