Skip to content

Commit ee1a613

Browse files
committed
fix: use raw output
1 parent c69a82c commit ee1a613

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func WithContext[T any](ctx context.Context) ProgramOption[T] {
2929
// won't need to use this.
3030
func WithOutput[T any](output io.Writer) ProgramOption[T] {
3131
return func(p *Program[T]) {
32-
p.Output = newSafeWriter(output)
32+
p.Output = output
3333
}
3434
}
3535

tea.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func NewProgram[T any](model Model[T], opts ...ProgramOption[T]) *Program[T] {
307307

308308
// if no output was set, set it to stdout
309309
if p.Output == nil {
310-
p.Output = newSafeWriter(os.Stdout)
310+
p.Output = os.Stdout
311311
}
312312

313313
// if no environment was set, set it to os.Environ()
@@ -331,7 +331,7 @@ func NewProgram[T any](model Model[T], opts ...ProgramOption[T]) *Program[T] {
331331
if _, err := LogToFile(tracePath, "bubbletea"); err == nil {
332332
// Enable different types of tracing.
333333
if output, _ := strconv.ParseBool(os.Getenv("TEA_TRACE_OUTPUT")); output {
334-
p.Output.(*safeWriter).trace = true
334+
// p.Output.(*safeWriter).trace = true
335335
}
336336
if input, _ := strconv.ParseBool(os.Getenv("TEA_TRACE_INPUT")); input {
337337
p.traceInput = true
@@ -745,7 +745,7 @@ func (p *Program[T]) Start() error {
745745

746746
// Get the color profile and send it to the program.
747747
if !p.startupOptions.has(withColorProfile) {
748-
p.profile = colorprofile.Detect(p.Output.(*safeWriter).Writer(), p.environ)
748+
p.profile = colorprofile.Detect(p.Output, p.environ)
749749
}
750750

751751
go p.Send(ColorProfileMsg{p.profile})

tty_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func (p *Program[T]) initInput() (err error) {
2222
}
2323
}
2424

25-
if f, ok := p.Output.(*safeWriter).Writer().(term.File); ok && term.IsTerminal(f.Fd()) {
25+
if f, ok := p.Output.(term.File); ok && term.IsTerminal(f.Fd()) {
2626
p.ttyOutput = f
2727
}
2828

0 commit comments

Comments
 (0)