{"record":{"id":"c5a74a29f60ab6f0","repo":"junegunn/fzf","slug":"adaptive-height-is-not-compatible-with-top-bottom","errorCode":null,"errorMessage":"adaptive height is not compatible with top/bottom percent margin","messagePattern":"adaptive height is not compatible with top/bottom percent margin","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":3647,"sourceCode":"\t\treturn errors.New(\"gutter display width should be 1\")\n\t}\n\n\tif opts.Scrollbar != nil {\n\t\trunes := []rune(*opts.Scrollbar)\n\t\tif len(runes) > 2 {\n\t\t\treturn errors.New(\"--scrollbar should be given one or two characters\")\n\t\t}\n\t\tfor _, r := range runes {\n\t\t\tif uniseg.StringWidth(string(r)) != 1 {\n\t\t\t\treturn errors.New(\"scrollbar display width should be 1\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif opts.Height.auto && (opts.Tmux == nil || opts.Tmux.index < opts.Height.index) {\n\t\tfor _, s := range []sizeSpec{opts.Margin[0], opts.Margin[2]} {\n\t\t\tif s.percent {\n\t\t\t\treturn errors.New(\"adaptive height is not compatible with top/bottom percent margin\")\n\t\t\t}\n\t\t}\n\t\tfor _, s := range []sizeSpec{opts.Padding[0], opts.Padding[2]} {\n\t\t\tif s.percent {\n\t\t\t\treturn errors.New(\"adaptive height is not compatible with top/bottom percent padding\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif opts.Theme.Nth.IsColorDefined() {\n\t\treturn errors.New(\"only ANSI attributes are allowed for 'nth' (regular, bold, underline, reverse, dim, italic, strikethrough)\")\n\t}\n\n\tif opts.BorderShape == tui.BorderInline ||\n\t\topts.ListBorderShape == tui.BorderInline ||\n\t\topts.InputBorderShape == tui.BorderInline ||\n\t\topts.Preview.border == tui.BorderInline {\n\t\treturn errors.New(\"inline border is only supported for --header-border, --header-lines-border, and --footer-border\")","sourceCodeStart":3629,"sourceCodeEnd":3665,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L3629-L3665","documentation":"When height is adaptive (--height ~N%), fzf cannot also compute top/bottom margins as a percentage of the screen, because both derive from the total screen height and would be circular. The check at options.go:3647 fires when opts.Height.auto is set (and not overridden by a later tmux height option) and either the top (Margin[0]) or bottom (Margin[2]) sizeSpec is a percent value.","triggerScenarios":"Combining --height='~50%' with -m 10%,10% or --margin='10%,5%,10%,5%'. Adaptive height plus any percent top/bottom margin triggers the error.","commonSituations":"Copy-pasted margin settings from a fixed-height layout into an adaptive-height one; migrating scripts to --height=~100% while keeping percent margins; wrapper scripts composing both options from user config.","solutions":["Use fixed (absolute) values for top/bottom margins with adaptive height (e.g. -m 2,4,2,4)","Or switch to a fixed height so percent margins are computable","In wrappers, detect --height values starting with '~' and downgrade percent margins to numbers"],"exampleFix":"# before\nfzf --height=~50% --margin=10%,0,10%,0\n# after\nfzf --height=~50% --margin=4,0,4,0","handlingStrategy":"validation","validationCode":"// Shell: downgrade percent margins when height is adaptive\ncase \"$height\" in '~'*) margins='4,2,4,2' ;; esac   # absolute top/bottom\nexec fzf --height=\"$height\" --margin=\"$margins\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never combine --height=~… with percent top/bottom margins","When height is adaptive, use absolute margin numbers","Centralize layout options so height/margin rules are checked in one place"],"tags":["fzf","cli","layout","validation","height"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}