Skip to content
Myr

Add style presets: --style=[default|minimal|full]

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

Close #4160

authored by Junegunn Choi · committed by Junegunn Choi · parent 0e0b868 · Browse files · 2 files+67 added−3 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+67 added−3 removed

  • other:+67 added−3 removed

2 files+67 added−3 removed

modified:src/options.go+55 added
65 unmodified lines
66 --filepath-word Make word-wise movements respect path separators67 --jump-labels=CHARS Label characters for jump mode6869 Layout70 --style=PRESET Apply a style preset [default|minimal|full]71 --height=[~]HEIGHT[%] Display fzf window below the cursor with the given72 height instead of using fullscreen.73 A negative value is calculated as the terminal height74 minus the given value.
2571 unmodified lines
2646 }2647 if err := parseLabelPosition(&opts.PreviewLabel, pos); err != nil {2648 return err2649 }2650 case "--style":2651 preset, err := nextString(allArgs, &i, "preset name required: [default|minimal|full]")2652 if err != nil {2653 return err2654 }2655 if err := applyPreset(opts, preset); err != nil {2656 return err2657 }2658 case "--no-unicode":2659 opts.Unicode = false2660 case "--unicode":2661 opts.Unicode = true
88 unmodified lines
2750 } else if match, value := optString(arg, "--tmux="); match {2751 if opts.Tmux, err = parseTmuxOptions(value, index); err != nil {2752 return err2753 }2754 } else if match, value := optString(arg, "--style="); match {2755 if err := applyPreset(opts, value); err != nil {2756 return err2757 }2758 } else if match, value := optString(arg, "--scheme="); match {2759 opts.Scheme = strings.ToLower(value)2760 } else if match, value := optString(arg, "-q", "--query="); match {2761 opts.Query = value
240 unmodified lines
3002 }3003 return err3004}30053006func applyPreset(opts *Options, preset string) error {3007 switch strings.ToLower(preset) {3008 case "default":3009 opts.ListBorderShape = tui.BorderUndefined3010 opts.InputBorderShape = tui.BorderUndefined3011 opts.HeaderBorderShape = tui.BorderUndefined3012 opts.Preview.border = tui.DefaultBorderShape3013 opts.Preview.info = true3014 opts.InfoStyle = infoDefault3015 opts.Theme.Gutter = tui.NewColorAttr()3016 opts.Separator = nil3017 opts.Scrollbar = nil3018 opts.CursorLine = false3019 case "minimal":3020 opts.ListBorderShape = tui.BorderUndefined3021 opts.InputBorderShape = tui.BorderUndefined3022 opts.HeaderBorderShape = tui.BorderUndefined3023 opts.Preview.border = tui.BorderLine3024 opts.Preview.info = false3025 opts.InfoStyle = infoDefault3026 opts.Theme.Gutter = tui.ColorAttr{Color: -1, Attr: 0}3027 empty := ""3028 opts.Separator = &empty3029 opts.Scrollbar = &empty3030 opts.CursorLine = false3031 case "full":3032 opts.ListBorderShape = tui.DefaultBorderShape3033 opts.InputBorderShape = tui.DefaultBorderShape3034 opts.HeaderBorderShape = tui.DefaultBorderShape3035 opts.Preview.border = tui.DefaultBorderShape3036 opts.Preview.info = true3037 opts.InfoStyle = infoInlineRight3038 opts.Theme.Gutter = tui.NewColorAttr()3039 opts.Separator = nil3040 opts.Scrollbar = nil3041 opts.CursorLine = true3042 default:3043 return errors.New("unsupported style preset: " + preset)3044 }3045 return nil3046}30473048func validateSign(sign string, signOptName string) error {3049 if uniseg.StringWidth(sign) > 2 {3050 return fmt.Errorf("%v display width should be up to 2", signOptName)3051 }
272 unmodified lines
modified:CHANGELOG.md+12 added-3 removed
1 unmodified line
2=========340.58.05------67This version introduces three new border types, `--list-border`, `--input-border`, and `--header-border`, offering much greater flexibility for customizing the user interface.89Also, fzf now offers three "style presets" for easier customization, which can be activated using the `--style=[default|minimal|full]` option.1011- Style presets (#4160)12 - `--style=full`13 - `--style=default`14 - `--style=minimal`6- Border and label for the list section15- Border and label for the list section (#4148)16 - Options17 - `--list-border[=STYLE]`18 - `--list-label=LABEL`19 - `--list-label-pos=COL[:bottom]`
4 unmodified lines
24 - `list-label`25 - Actions26 - `change-list-label`27 - `transform-list-label`19- Border and label for the input section (prompt line and info line)28- Border and label for the input section (prompt line and info line) (#4154)29 - Options30 - `--input-border[=STYLE]`31 - `--input-label=LABEL`32 - `--input-label-pos=COL[:bottom]`
4 unmodified lines
37 - `input-label`38 - Actions39 - `change-input-label`40 - `transform-input-label`32- Border and label for the header section41- Border and label for the header section (#4159)42 - Options43 - `--header-border[=STYLE]`44 - `--header-label=LABEL`45 - `--header-label-pos=COL[:bottom]`
2346 unmodified lines