Documentation
¶
Overview ¶
devtui/internal/ui/base_pager_model.go
Index ¶
- Constants
- Variables
- func Indent(s string, n int) string
- func WaitForStatusMessageTimeout(t *time.Timer) tea.Cmd
- type BasePagerModel
- func (m *BasePagerModel) FormatHelpColumns(col1 []string) string
- func (m *BasePagerModel) HandleCommonKeys(msg tea.KeyMsg) (tea.Cmd, bool)
- func (m *BasePagerModel) HandleWindowSizeMsg(msg tea.WindowSizeMsg) tea.Cmd
- func (m BasePagerModel) Init() tea.Cmd
- func (m *BasePagerModel) SetSize(w, h int)
- func (m *BasePagerModel) ShowErrorMessage(message string) tea.Cmd
- func (m *BasePagerModel) ShowStatusMessage(message string) tea.Cmd
- func (m *BasePagerModel) StatusBarView() string
- func (m *BasePagerModel) ToggleHelp()
- type CommonModel
- type PagerState
- type PagerStatusMsg
- type ReturnToListMsg
- type StatusMessageTimeoutMsg
- type Styles
Constants ¶
View Source
const ( StatusBarHeight = 1 Ellipsis = "…" )
View Source
const AppTitle = "DevTUI"
View Source
const StatusMessageTimeout = time.Second * 3 // how long to show status messages like "stashed!"
Variables ¶
View Source
var ( HelpViewStyle = lipgloss.NewStyle(). Foreground(statusBarNoteFg). Background(lipgloss.AdaptiveColor{Light: "#f2f2f2", Dark: "#1B1B1B"}). Render StatusBarNoteStyle = lipgloss.NewStyle(). Foreground(statusBarNoteFg). Background(statusBarBg).Render AppNameStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("230")). Background(lipgloss.Color("62")). Bold(true).Render StatusBarErrorHelpStyle = lipgloss.NewStyle(). Foreground(lightRed). Background(darkRed).Render StatusBarMessageHelpStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#B6FFE4")). Background(green).Render StatusBarHelpStyle = lipgloss.NewStyle(). Foreground(statusBarNoteFg). Background(lipgloss.AdaptiveColor{Light: "#DCDCDC", Dark: "#323232"}).Render StatusBarScrollPosStyle = lipgloss.NewStyle(). Foreground(lipgloss.AdaptiveColor{Light: "#949494", Dark: "#5A5A5A"}). Background(statusBarBg). Render StatusBarMessageStyle = lipgloss.NewStyle(). Foreground(mintGreen). Background(darkGreen).Render StatusBarErrorStyle = lipgloss.NewStyle(). Foreground(lightRed). Background(darkRed).Render LineNumberStyle = lipgloss.NewStyle(). Foreground(lineNumberFg). Render )
View Source
var PagePaddingStyle = lipgloss.NewStyle().Padding(2)
Functions ¶
Types ¶
type BasePagerModel ¶
type BasePagerModel struct {
Common *CommonModel
Title string
Content string
FormattedContent string
Viewport viewport.Model
ShowHelp bool
Ready bool
State PagerState
StatusMessage string
StatusMessageTimer *time.Timer
HelpHeight int
}
BasePagerModel provides common functionality for pager-based TUI views. There is a lot of common
func NewBasePagerModel ¶
func NewBasePagerModel(common *CommonModel, title string) BasePagerModel
func (*BasePagerModel) FormatHelpColumns ¶
func (m *BasePagerModel) FormatHelpColumns(col1 []string) string
FormatHelpColumns formats the help view with columns
func (*BasePagerModel) HandleCommonKeys ¶
func (*BasePagerModel) HandleWindowSizeMsg ¶
func (m *BasePagerModel) HandleWindowSizeMsg(msg tea.WindowSizeMsg) tea.Cmd
func (BasePagerModel) Init ¶
func (m BasePagerModel) Init() tea.Cmd
func (*BasePagerModel) SetSize ¶
func (m *BasePagerModel) SetSize(w, h int)
func (*BasePagerModel) ShowErrorMessage ¶
func (m *BasePagerModel) ShowErrorMessage(message string) tea.Cmd
func (*BasePagerModel) ShowStatusMessage ¶
func (m *BasePagerModel) ShowStatusMessage(message string) tea.Cmd
func (*BasePagerModel) StatusBarView ¶
func (m *BasePagerModel) StatusBarView() string
func (*BasePagerModel) ToggleHelp ¶
func (m *BasePagerModel) ToggleHelp()
type CommonModel ¶
type PagerState ¶
type PagerState int
const ( PagerStateBrowse PagerState = iota PagerStateStatusMessage PagerStateErrorMessage )
type PagerStatusMsg ¶
type PagerStatusMsg struct {
Message string
}
type ReturnToListMsg ¶
type ReturnToListMsg struct {
Common *CommonModel
}
type StatusMessageTimeoutMsg ¶
type StatusMessageTimeoutMsg struct{}
Click to show internal directories.
Click to hide internal directories.