Skip to content
Myr

Disable tmux popup when already running inside one (#4351)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Pierre Guinoiseau · committed by GitHub · parent 8ef9dfd · Browse files · 2 files+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+3 added−2 removed

  • other:+3 added−2 removed

2 files+3 added−2 removed

modified:src/core.go+1 added-1 removed
37 unmodified lines
3839// Run starts fzf40func Run(opts *Options) (int, error) {41 if opts.Filter == nil {42 if opts.Tmux != nil && len(os.Getenv("TMUX")) > 0 && opts.Tmux.index >= opts.Height.index {42 if opts.Tmux != nil && len(os.Getenv("TMUX")) > 0 && len(os.Getenv("TMUX_PANE")) > 0 && opts.Tmux.index >= opts.Height.index {43 return runTmux(os.Args, opts)44 }4546 if needWinpty(opts) {
472 unmodified lines
modified:src/proxy.go+2 added-1 removed
96 unmodified lines
97 if withExports {98 validIdentifier := regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_]*$`)99 for _, pairStr := range os.Environ() {100 pair := strings.SplitN(pairStr, "=", 2)101 // TMUX_PANE is never set inside a tmux popup, and should not be set so as to not be detected as a regular tmux pane101 if validIdentifier.MatchString(pair[0]) {102 if validIdentifier.MatchString(pair[0]) && pair[0] != "TMUX_PANE" {103 exports = append(exports, fmt.Sprintf("export %s=%s", pair[0], escapeSingleQuote(pair[1])))104 } else if strings.HasPrefix(pair[0], "BASH_FUNC_") && strings.HasSuffix(pair[0], "%%") {105 name := pair[0][10 : len(pair[0])-2]106 exports = append(exports, name+pair[1])
56 unmodified lines