mirror of
https://github.com/charmbracelet/lipgloss.git
synced 2024-08-17 09:50:31 +03:00
fix(renderer): use termenv default renderer
Creating a _new_ global termenv output clashes with the default global termenv output leading the terminal to block and freeze. Share the default termenv output with the global default lipgloss renderer.
This commit is contained in:
parent
19ca9a3f8c
commit
7f47f0b5e0
@ -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 {
|
||||
|
2
style.go
2
style.go
@ -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...)
|
||||
|
Loading…
Reference in New Issue
Block a user