MCPcopy
hub / github.com/junegunn/fzf / postProcessOptions

Function postProcessOptions

src/options.go:3703–3891  ·  view source on GitHub ↗

This function can have side-effects and alter some global states. So we run it on fzf.Run and not on ParseOptions.

(opts *Options)

Source from the content-addressed store, hash-verified

3701// This function can have side-effects and alter some global states.
3702// So we run it on fzf.Run and not on ParseOptions.
3703func postProcessOptions(opts *Options) error {
3704 if opts.Ambidouble {
3705 uniseg.EastAsianAmbiguousWidth = 2
3706 }
3707
3708 if opts.BorderShape == tui.BorderUndefined {
3709 opts.BorderShape = tui.BorderNone
3710 }
3711
3712 if opts.ListBorderShape == tui.BorderUndefined {
3713 opts.ListBorderShape = tui.BorderNone
3714 }
3715
3716 if opts.InputBorderShape == tui.BorderUndefined {
3717 opts.InputBorderShape = tui.BorderNone
3718 }
3719
3720 if opts.HeaderBorderShape == tui.BorderUndefined {
3721 opts.HeaderBorderShape = tui.BorderNone
3722 }
3723
3724 if opts.FooterBorderShape == tui.BorderUndefined {
3725 opts.FooterBorderShape = tui.BorderLine
3726 }
3727
3728 if opts.HeaderLinesShape == tui.BorderNone {
3729 opts.HeaderLinesShape = tui.BorderPhantom
3730 }
3731
3732 if opts.Pointer == nil {
3733 defaultPointer := "▌"
3734 if !opts.Unicode {
3735 defaultPointer = ">"
3736 }
3737 opts.Pointer = &defaultPointer
3738 }
3739
3740 if opts.GapLine == nil {
3741 defaultGapLine := "┈"
3742 if !opts.Unicode {
3743 defaultGapLine = "-"
3744 }
3745 opts.GapLine = &defaultGapLine
3746 }
3747
3748 markerLen := 1
3749 if opts.Marker == nil {
3750 if opts.MarkerMulti != nil && opts.MarkerMulti[0] == "" {
3751 empty := ""
3752 opts.Marker = &empty
3753 markerLen = 0
3754 } else {
3755 // "▎" looks better, but not all terminals render it correctly
3756 defaultMarker := "┃"
3757 if !opts.Unicode {
3758 defaultMarker = ">"
3759 }
3760 opts.Marker = &defaultMarker

Callers 4

TestIrrelevantNthFunction · 0.85
TestDefaultCtrlNPFunction · 0.85
optsForFunction · 0.85
RunFunction · 0.85

Calls 9

IsLightRendererSupportedFunction · 0.92
InitFunction · 0.92
toActionsFunction · 0.85
defaultKeymapFunction · 0.85
borderLinesFunction · 0.85
AsEventMethod · 0.80
noSeparatorLineMethod · 0.45
VisibleMethod · 0.45
initProfilingMethod · 0.45

Tested by 3

TestIrrelevantNthFunction · 0.68
TestDefaultCtrlNPFunction · 0.68
optsForFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…