From 40a0456edf6a4f253a63f58a75085b770259f4f1 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Wed, 11 Sep 2024 14:14:57 -0300 Subject: [PATCH] fix: raw output being rendered twice (#346) --- main.go | 10 +++++----- mods.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 8fcedc81..e997c6f1 100644 --- a/main.go +++ b/main.go @@ -78,14 +78,14 @@ var ( RunE: func(cmd *cobra.Command, args []string) error { config.Prefix = removeWhitespace(strings.Join(args, " ")) - opts := []tea.ProgramOption{ - tea.WithOutput(os.Stderr), - } + opts := []tea.ProgramOption{} - if !isInputTTY() { + if !isInputTTY() || config.Raw { opts = append(opts, tea.WithInput(nil)) } - if !isOutputTTY() { + if isOutputTTY() && !config.Raw { + opts = append(opts, tea.WithOutput(os.Stderr)) + } else { opts = append(opts, tea.WithoutRenderer()) } if os.Getenv("VIMRUNTIME") != "" { diff --git a/mods.go b/mods.go index 74fe49c8..51a1677e 100644 --- a/mods.go +++ b/mods.go @@ -215,7 +215,7 @@ func (m *Mods) View() string { return m.glamOutput } - if isOutputTTY() { + if isOutputTTY() && !m.Config.Raw { return m.Output }