wip: filepicker, help, list, table, textarea, textinput, viewport

This commit is contained in:
Carlos Alexandro Becker
2024-02-26 13:31:26 -03:00
parent 8f8d5fc7d9
commit e9bbc869c0
11 changed files with 76 additions and 62 deletions
+4 -2
View File
@@ -11,9 +11,10 @@ import (
// New returns a new model with the given width and height as well as default
// key mappings.
func New(width, height int) (m Model) {
func New(ctx *tea.Context, width, height int) (m Model) {
m.Width = width
m.Height = height
m.renderer = ctx.Renderer
m.setInitialValues()
return m
}
@@ -54,6 +55,7 @@ type Model struct {
initialized bool
lines []string
renderer *lipgloss.Renderer
}
func (m *Model) setInitialValues() {
@@ -372,7 +374,7 @@ func (m Model) View() string {
}
contentWidth := w - m.Style.GetHorizontalFrameSize()
contentHeight := h - m.Style.GetVerticalFrameSize()
contents := lipgloss.NewStyle().
contents := m.renderer.NewStyle().
Width(contentWidth). // pad to width.
Height(contentHeight). // pad to height.
MaxHeight(contentHeight). // truncate height if taller.