From 5fe4706dff25965c26d2eb620e20739b16ee4f0a Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 26 Feb 2024 14:09:54 -0300 Subject: [PATCH] fix: cursor actually need to take the renderer too --- cursor/cursor.go | 8 +++++--- textarea/textarea.go | 2 +- textinput/textinput.go | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cursor/cursor.go b/cursor/cursor.go index 5abda65..610b7cc 100644 --- a/cursor/cursor.go +++ b/cursor/cursor.go @@ -75,12 +75,14 @@ type Model struct { } // New creates a new model with default settings. -func New() Model { +func New(ctx *tea.Context) Model { return Model{ BlinkSpeed: defaultBlinkSpeed, - Blink: true, - mode: CursorBlink, + Blink: true, + mode: CursorBlink, + TextStyle: ctx.Renderer.NewStyle(), + Style: ctx.Renderer.NewStyle(), blinkCtx: &blinkCtx{ ctx: context.Background(), diff --git a/textarea/textarea.go b/textarea/textarea.go index f5f115a..6edd4be 100644 --- a/textarea/textarea.go +++ b/textarea/textarea.go @@ -249,7 +249,7 @@ type Model struct { func New(ctx *tea.Context) Model { vp := viewport.New(ctx, 0, 0) vp.KeyMap = viewport.KeyMap{} - cur := cursor.New() + cur := cursor.New(ctx) focusedStyle, blurredStyle := DefaultStyles(ctx.Renderer) diff --git a/textinput/textinput.go b/textinput/textinput.go index 8f65895..b93f3f5 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -164,7 +164,7 @@ func New(ctx *tea.Context) Model { PlaceholderStyle: r.NewStyle().Foreground(lipgloss.Color("240")), ShowSuggestions: false, CompletionStyle: r.NewStyle().Foreground(lipgloss.Color("240")), - Cursor: cursor.New(), + Cursor: cursor.New(ctx), KeyMap: DefaultKeyMap, suggestions: [][]rune{},