From 37cd043920aa92189d9ae19e7631968290e4d352 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Wed, 4 Dec 2024 18:35:11 +0200 Subject: Started work on basic vim input box --- internal/client/ui/core/chat/chat.go | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 internal/client/ui/core/chat/chat.go (limited to 'internal/client/ui/core/chat') diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go new file mode 100644 index 0000000..b3597a8 --- /dev/null +++ b/internal/client/ui/core/chat/chat.go @@ -0,0 +1,48 @@ +package chat + +import ( + "log" + + "github.com/charmbracelet/bubbles/textarea" + tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/lipgloss" + + "github.com/kyren223/eko/internal/client/ui/colors" + "github.com/kyren223/eko/internal/client/ui/viminput" +) + +type Model struct { + vi viminput.Model +} + +func New() Model { + vi := viminput.New(30, 3) + vi.Placeholder = "Send a message..." + vi.PlaceholderStyle = lipgloss.NewStyle().Foreground(colors.Gray) + vi.LineDecoration = func(lnum int, line string, cursorLnum int) string { + return "┃ " + } + // vi.ShowLineNumbers = false + + // vi.CharLimit = 280 + + // vi.Focus() + + log.Println("Placeholder:", vi.Placeholder) + + return Model{ + vi: vi, + } +} + +func (m Model) Init() tea.Cmd { + return tea.Batch(textarea.Blink, nil) +} + +func (m Model) View() string { + return m.vi.View() +} + +func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { + return m, nil +} -- cgit v1.3.1