Use winpty to launch fzf in Git bash (mintty)

Close #3806

Known limitation:
* --height cannot be used
This commit is contained in:
Junegunn Choi
2024-05-20 17:06:44 +09:00
parent aee417c46a
commit 573df524fe
12 changed files with 315 additions and 157 deletions

View File

@@ -322,7 +322,7 @@ type Terminal struct {
forcePreview bool
clickHeaderLine int
clickHeaderColumn int
tmuxScript string
proxyScript string
}
type selectedItem struct {
@@ -795,7 +795,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
jumpLabels: opts.JumpLabels,
printer: opts.Printer,
printsep: opts.PrintSep,
tmuxScript: opts.TmuxScript,
proxyScript: opts.ProxyScript,
merger: EmptyMerger(0),
selected: make(map[int32]selectedItem),
reqBox: util.NewEventBox(),
@@ -3608,9 +3608,9 @@ func (t *Terminal) Loop() error {
t.history.append(string(t.input))
}
if len(t.tmuxScript) > 0 {
if len(t.proxyScript) > 0 {
data := strings.Join(append([]string{command}, t.environ()...), "\x00")
os.WriteFile(t.tmuxScript, []byte(data), 0600)
os.WriteFile(t.proxyScript+becomeSuffix, []byte(data), 0600)
req(reqBecome)
} else {
t.executor.Become(t.ttyin, t.environ(), command)