Skip to content
Myr

Add "eof" action which closes the finder only when input is empty

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

Close #289

authored by Junegunn Choi · committed by Junegunn Choi · parent b53f61f · Browse files · 5 files+23 added−0 removed
This commit

State

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

Diff stats

5 files+23 added−0 removed

  • tests:+13 added−0 removed
  • other:+10 added−0 removed

5 files+23 added−0 removed

modified:man/man1/fzf.1+1 added
191 unmodified lines
192 \fBdelete-char\fR \fIctrl-d del\fR193 \fBdeselect-all\fR194 \fBdown\fR \fIctrl-j ctrl-n down\fR195 \fBend-of-line\fR \fIctrl-e end\fR196 \fBeof\fR197 \fBexecute(...)\fR (see below for the details)198 \fBforward-char\fR \fIctrl-f right\fR199 \fBforward-word\fR \fIalt-f shift-right\fR200 \fBignore\fR
176 unmodified lines
modified:src/options.go+2 added
497 unmodified lines
498 case "delete-char":499 keymap[key] = actDeleteChar500 case "end-of-line":501 keymap[key] = actEndOfLine502 case "eof":503 keymap[key] = actEof504 case "forward-char":505 keymap[key] = actForwardChar506 case "forward-word":507 keymap[key] = actForwardWord
324 unmodified lines
modified:src/terminal.go+5 added
101 unmodified lines
102 actBackwardWord103 actClearScreen104 actDeleteChar105 actEndOfLine106 actEof107 actForwardChar108 actForwardWord109 actKillLine110 actKillWord
702 unmodified lines
813 req(reqQuit)814 }815 case actEndOfLine:816 t.cx = len(t.input)817 case actEof:818 if len(t.input) == 0 {819 req(reqQuit)820 }821 case actForwardChar:822 if t.cx < len(t.input) {823 t.cx++824 }
217 unmodified lines
modified:test/test_go.rb+13 added
716 unmodified lines
717 lines[2..6].map(&:strip) == header718 end719 end720721 def test_eof722 tmux.send_keys "seq 100 | #{fzf "--bind 2:eof"}", :Enter723 tmux.until { |lines| lines[-2].include?('100/100') }724 tmux.send_keys '123'725 tmux.until do |lines|726 lines[-1] == '> 13' && lines[-2].include?('1/100')727 end728 tmux.send_keys :BSpace, :BSpace729 tmux.until { |lines| lines[-1] == '>' }730 tmux.send_keys 2731 tmux.prepare732 end733734private735 def writelines path, lines736 File.unlink path while File.exists? path737 File.open(path, 'w') { |f| f << lines.join($/) }
237 unmodified lines
modified:CHANGELOG.md+2 added
7 unmodified lines
89- Added options for sticky header10 - `--header-file`11 - `--header-lines`12- Added `eof` action which closes the finder only when the input is empty13 - e.g. `export FZF_DEFAULT_OPTS="--bind esc:eof"`1415### Minor improvements/fixes1617- Fixed to allow binding colon and comma keys
239 unmodified lines