Change default pointer and marker character
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* Pointer: '▌' * Marker: '▏' They will still be set to '>' if `--no-unicode` is given. Reasons: * They look okay * They work better with multi-line items (WIP)
authored by Junegunn Choi · committed by Junegunn Choi · parent 04dfb14 · Browse files · 4 files·+43 added−19 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+43 added−19 removed
- tests:+7 added−3 removed
- other:+36 added−16 removed
Provenance
- Commit
5b204c5- Tree
cef3aa9- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
04dfb14
4 files changed+43 added−19 removed
modified:man/man1/fzf.1+2 added-2 removed
436 unmodified lines437 .BI "--prompt=" "STR"438 Input prompt (default: '> ')439 .TP440 .BI "--pointer=" "STR"441-Pointer to the current line (default: '>')441+Pointer to the current line (default: '▌' or '>' depending on \fB--no-unicode\fR)442 .TP443 .BI "--marker=" "STR"444-Multi-select marker (default: '>')444+Multi-select marker (default: '▏' or '>' depending on \fB--no-unicode\fR)445 .TP446 .BI "--header=" "STR"447 The given string will be printed as the sticky header. The lines are displayed448 in the given order from top to bottom regardless of \fB--layout\fR option, and1145 unmodified linesmodified:src/options.go+32 added-12 removed
81 unmodified lines82 --no-separator Hide info line separator83 --scrollbar[=C1[C2]] Scrollbar character(s) (each for main and preview window)84 --no-scrollbar Hide scrollbar85 --prompt=STR Input prompt (default: '> ')86- --pointer=STR Pointer to the current line (default: '>')87- --marker=STR Multi-select marker (default: '>')86+ --pointer=STR Pointer to the current line (default: '▌' or '>')87+ --marker=STR Multi-select marker (default: '▏' or '>')88 --header=STR String to print as header89 --header-lines=N The first N lines of the input are treated as header90 --header-first Print header before the prompt line91 --ellipsis=STR Ellipsis to show when line is truncated (default: '..')327 unmodified lines419 InfoPrefix string420 Separator *string421 JumpLabels string422 Prompt string423- Pointer string424- Marker string423+ Pointer *string424+ Marker *string425 Query string426 Select1 bool427 Exit0 bool428 Filter *string85 unmodified lines514 InfoStyle: infoDefault,515 Separator: nil,516 JumpLabels: defaultJumpLabels,517 Prompt: "> ",518- Pointer: ">",519- Marker: ">",518+ Pointer: nil,519+ Marker: nil,520 Query: "",521 Select1: false,522 Exit0: false,523 Filter: nil,1628 unmodified lines2152 str, err := nextString(allArgs, &i, "pointer sign string required")2153 if err != nil {2154 return err2155 }2156- opts.Pointer = firstLine(str)2156+ str = firstLine(str)2157+ opts.Pointer = &str2158 case "--marker":2159 str, err := nextString(allArgs, &i, "selected sign string required")2160 if err != nil {2161 return err2162 }2162- opts.Marker = firstLine(str)2163+ str = firstLine(str)2164+ opts.Marker = &str2165 case "--sync":2166 opts.Sync = true2167 case "--no-sync", "--async":2168 opts.Sync = false227 unmodified lines2396 }2397 } else if match, value := optString(arg, "--prompt="); match {2398 opts.Prompt = value2399 } else if match, value := optString(arg, "--pointer="); match {2398- opts.Pointer = firstLine(value)2400+ str := firstLine(value)2401+ opts.Pointer = &str2402 } else if match, value := optString(arg, "--marker="); match {2400- opts.Marker = firstLine(value)2403+ str := firstLine(value)2404+ opts.Marker = &str2405 } else if match, value := optString(arg, "-n", "--nth="); match {2406 if opts.Nth, err = splitNth(value); err != nil {2407 return err2408 }180 unmodified lines2589 if opts.BorderShape == tui.BorderUndefined {2590 opts.BorderShape = tui.BorderNone2591 }2592 2593+ if opts.Pointer == nil {2594+ defaultPointer := "▌"2595+ if !opts.Unicode {2596+ defaultPointer = ">"2597+ }2598+ opts.Pointer = &defaultPointer2599+ }2600+2601+ if opts.Marker == nil {2602+ defaultMarker := "▏"2603+ if !opts.Unicode {2604+ defaultMarker = ">"2605+ }2606+ opts.Marker = &defaultMarker2607+ }2608+2589- if err := validateSign(opts.Pointer, "pointer"); err != nil {2609+ if err := validateSign(*opts.Pointer, "pointer"); err != nil {2610 return err2611 }2612 2593- if err := validateSign(opts.Marker, "marker"); err != nil {2613+ if err := validateSign(*opts.Marker, "marker"); err != nil {2614 return err2615 }2616 2617 if !tui.IsLightRendererSupported() && opts.Height.size > 0 {151 unmodified linesmodified:src/terminal.go+2 added-2 removed
809 unmodified lines810 executing: util.NewAtomicBool(false),811 lastAction: actStart,812 lastFocus: minItem.Index()}813 t.prompt, t.promptLen = t.parsePrompt(opts.Prompt)814- t.pointer, t.pointerLen = t.processTabs([]rune(opts.Pointer), 0)815- t.marker, t.markerLen = t.processTabs([]rune(opts.Marker), 0)814+ t.pointer, t.pointerLen = t.processTabs([]rune(*opts.Pointer), 0)815+ t.marker, t.markerLen = t.processTabs([]rune(*opts.Marker), 0)816 // Pre-calculated empty pointer and marker signs817 t.pointerEmpty = strings.Repeat(" ", t.pointerLen)818 t.markerEmpty = strings.Repeat(" ", t.markerLen)819 t.borderLabel, t.borderLabelLen = t.ansiLabelPrinter(opts.BorderLabel.label, &tui.ColBorderLabel, false)3599 unmodified linesmodified:test/test_go.rb+7 added-3 removed
22 unmodified lines23 24 FILE = File.expand_path(__FILE__)25 BASE = File.expand_path('..', __dir__)26 Dir.chdir(BASE)27-FZF = "FZF_DEFAULT_OPTS=--no-scrollbar FZF_DEFAULT_COMMAND= #{BASE}/bin/fzf"27+FZF = "FZF_DEFAULT_OPTS=\"--no-scrollbar --pointer \\> --marker \\>\" FZF_DEFAULT_COMMAND= #{BASE}/bin/fzf"28 29 def wait30 since = Time.now31 begin33 unmodified lines65 end66 end67 68 def fish69- "unset #{UNSETS.join(' ')}; FZF_DEFAULT_OPTS=--no-scrollbar fish_history= fish"69+ "unset #{UNSETS.join(' ')}; FZF_DEFAULT_OPTS=\"--no-scrollbar --pointer '>' --marker '>'\" fish_history= fish"70 end71 end72 end73 3322 unmodified lines3396 tmux.until { |lines| assert_equal '3rd', lines[-1] }3397 end3398 3399 def test_ctrl_r_multiline3400+ # NOTE: Current bash implementation shows an extra new line if there's3401+ # only enty in the history3402+ tmux.send_keys ':', :Enter3403 tmux.send_keys 'echo "foo', :Enter, 'bar"', :Enter3404 tmux.until { |lines| assert_equal %w[foo bar], lines[-2..] }3405 tmux.prepare3406 tmux.send_keys 'C-r'3407 tmux.until { |lines| assert_equal '>', lines[-1] }3408 tmux.send_keys 'foo bar'3409+ tmux.until { |lines| assert lines[-4]&.match?(/"foo/) } unless shell == :zsh3410 tmux.until { |lines| assert lines[-3]&.match?(/bar"␊?/) }3411 tmux.send_keys :Enter3412 tmux.until { |lines| assert lines[-1]&.match?(/bar"␊?/) }3413 tmux.send_keys :Enter331 unmodified lines3745 unset <%= UNSETS.join(' ') %>3746 unset $(env | sed -n /^_fzf_orig/s/=.*//p)3747 unset $(declare -F | sed -n "/_fzf/s/.*-f //p")3748 3745-export FZF_DEFAULT_OPTS=--no-scrollbar3749+export FZF_DEFAULT_OPTS="--no-scrollbar --pointer '>' --marker '>'"3750 3751 # Setup fzf3752 # ---------3753 if [[ ! "$PATH" == *<%= BASE %>/bin* ]]; then48 unmodified lines