Ignore --height option if it's not supported on the platform

This is to make shell integration work out of the box on Git bash.

  eval "$(fzf --bash)"
  vim <CTRL-T>
    # would print '--height option is currently not supported on this platform'
pull/3807/head
Junegunn Choi 4 months ago
parent 564daf9a7d
commit 555b0d235b
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

@ -2685,10 +2685,6 @@ func validateOptions(opts *Options) error {
} }
} }
if !tui.IsLightRendererSupported() && opts.Height.size > 0 {
return errors.New("--height option is currently not supported on this platform")
}
if opts.Scrollbar != nil { if opts.Scrollbar != nil {
runes := []rune(*opts.Scrollbar) runes := []rune(*opts.Scrollbar)
if len(runes) > 2 { if len(runes) > 2 {
@ -2841,6 +2837,11 @@ func postProcessOptions(opts *Options) error {
theme.Spinner = boldify(theme.Spinner) theme.Spinner = boldify(theme.Spinner)
} }
// If --height option is not supported on the platform, just ignore it
if !tui.IsLightRendererSupported() && opts.Height.size > 0 {
opts.Height = heightSpec{}
}
if err := opts.initProfiling(); err != nil { if err := opts.initProfiling(); err != nil {
return errors.New("failed to start pprof profiles: " + err.Error()) return errors.New("failed to start pprof profiles: " + err.Error())
} }

@ -24,12 +24,11 @@ func needWinpty(opts *Options) bool {
See: https://github.com/junegunn/fzf/issues/3809 See: https://github.com/junegunn/fzf/issues/3809
"MSYS=enable_pcon" allows fzf to run properly on mintty 3.4.5 or later, "MSYS=enable_pcon" allows fzf to run properly on mintty 3.4.5 or later,
however `--height` option still doesn't work, so let's just disable it. however `--height` option still doesn't work, and it's going to be ignored.
We're not going to worry too much about restoring the original value. We're not going to worry too much about restoring the original value.
*/ */
if strings.Contains(os.Getenv("MSYS"), "enable_pcon") { if strings.Contains(os.Getenv("MSYS"), "enable_pcon") {
opts.Height = heightSpec{}
return false return false
} }

Loading…
Cancel
Save