Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(renderer): use termenv default renderer #179

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ package lipgloss

import (
"io"
"os"

"github.com/muesli/termenv"
)

var renderer = NewRenderer(os.Stdout)
// We're manually creating the struct here to avoid initializing the output and
// query the terminal multiple times.
var renderer = &Renderer{
output: termenv.DefaultOutput(),
}

// Renderer is a lipgloss terminal renderer.
type Renderer struct {
Expand Down
2 changes: 1 addition & 1 deletion style.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (s Style) Inherit(i Style) Style {
// Render applies the defined style formatting to a given string.
func (s Style) Render(strs ...string) string {
if s.r == nil {
s.r = DefaultRenderer()
s.r = renderer
}
if s.value != "" {
strs = append([]string{s.value}, strs...)
Expand Down