From 3dee8778d073199e0fe1e186e54f7eabc2fdef43 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 23 May 2024 20:08:20 +0900 Subject: execute: Open separate handles to /dev/tty (in, out, err) # This will no longer cause 'Vim: Warning: Output is not to a terminal' fzf --bind 'enter:execute:vim {}' > /tmp/foo --- src/tui/light.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/tui/light.go') diff --git a/src/tui/light.go b/src/tui/light.go index 1181d167..f202899a 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -127,11 +127,7 @@ type LightWindow struct { bg Color } -func NewLightRenderer(theme *ColorTheme, forceBlack bool, mouse bool, tabstop int, clearOnExit bool, fullscreen bool, maxHeightFunc func(int) int) (Renderer, error) { - in, err := openTtyIn() - if err != nil { - return nil, err - } +func NewLightRenderer(ttyin *os.File, theme *ColorTheme, forceBlack bool, mouse bool, tabstop int, clearOnExit bool, fullscreen bool, maxHeightFunc func(int) int) (Renderer, error) { out, err := openTtyOut() if err != nil { out = os.Stderr @@ -142,7 +138,7 @@ func NewLightRenderer(theme *ColorTheme, forceBlack bool, mouse bool, tabstop in forceBlack: forceBlack, mouse: mouse, clearOnExit: clearOnExit, - ttyin: in, + ttyin: ttyin, ttyout: out, yoffset: 0, tabstop: tabstop, -- cgit v1.2.3