summaryrefslogtreecommitdiff
path: root/src/tui/light.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-05-23 20:08:20 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-05-23 21:11:12 +0900
commit3dee8778d073199e0fe1e186e54f7eabc2fdef43 (patch)
tree1c39e76cf456b176cee9c4763ddbd8447e4ce406 /src/tui/light.go
parentd4216b0dcc13567479d81cc5ad2adedb1443ea8b (diff)
downloadfzf-3dee8778d073199e0fe1e186e54f7eabc2fdef43.tar.gz
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
Diffstat (limited to 'src/tui/light.go')
-rw-r--r--src/tui/light.go8
1 files changed, 2 insertions, 6 deletions
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,