Replace eof action with cancel (#289)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent f9136cf · Browse files · 5 files·+19 added−14 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+19 added−14 removed
- tests:+7 added−7 removed
- other:+12 added−7 removed
Provenance
- Commit
fdbf3d3- Tree
f4c1447- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
f9136cf
5 files changed+19 added−14 removed
modified:man/man1/fzf.1+1 added-1 removed
186 unmodified lines187 \fBbackward-delete-char\fR \fIctrl-h bspace\fR188 \fBbackward-kill-word\fR \fIalt-bs\fR189 \fBbackward-word\fR \fIalt-b shift-left\fR190 \fBbeginning-of-line\fR \fIctrl-a home\fR191+ \fBcancel\fR192 \fBclear-screen\fR \fIctrl-l\fR193 \fBdelete-char\fR \fIdel\fR194 \fBdelete-char/eof\fR \fIctrl-d\fR195 \fBdeselect-all\fR196 \fBdown\fR \fIctrl-j ctrl-n down\fR197 \fBend-of-line\fR \fIctrl-e end\fR197- \fBeof\fR198 \fBexecute(...)\fR (see below for the details)199 \fBforward-char\fR \fIctrl-f right\fR200 \fBforward-word\fR \fIalt-f shift-right\fR201 \fBignore\fR176 unmodified linesmodified:src/options.go+2 added-2 removed
499 unmodified lines500 case "delete-char/eof":501 keymap[key] = actDeleteCharEof502 case "end-of-line":503 keymap[key] = actEndOfLine504- case "eof":505- keymap[key] = actEof504+ case "cancel":505+ keymap[key] = actCancel506 case "forward-char":507 keymap[key] = actForwardChar508 case "forward-word":509 keymap[key] = actForwardWord324 unmodified linesmodified:src/terminal.go+6 added-2 removed
98 unmodified lines99 actAccept100 actBackwardChar101 actBackwardDeleteChar102 actBackwardWord103+ actCancel104 actClearScreen105 actDeleteChar106 actDeleteCharEof107 actEndOfLine107- actEof108 actForwardChar109 actForwardWord110 actKillLine111 actKillWord704 unmodified lines816 req(reqQuit)817 }818 case actEndOfLine:819 t.cx = len(t.input)820- case actEof:820+ case actCancel:821 if len(t.input) == 0 {822 req(reqQuit)823+ } else {824+ t.yanked = t.input825+ t.input = []rune{}826+ t.cx = 0827 }828 case actForwardChar:829 if t.cx < len(t.input) {830 t.cx++218 unmodified linesmodified:test/test_go.rb+7 added-7 removed
716 unmodified lines717 lines[2..6].map(&:strip) == header718 end719 end720 721- def test_eof722- tmux.send_keys "seq 100 | #{fzf "--bind 2:eof"}", :Enter723- tmux.until { |lines| lines[-2].include?('100/100') }721+ def test_canel722+ tmux.send_keys "seq 10 | #{fzf "--bind 2:cancel"}", :Enter723+ tmux.until { |lines| lines[-2].include?('10/10') }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, :BSpace725+ tmux.until { |lines| lines[-1] == '> 3' && lines[-2].include?('1/10') }726+ tmux.send_keys 'C-y', 'C-y'727+ tmux.until { |lines| lines[-1] == '> 311' }728+ tmux.send_keys 2729 tmux.until { |lines| lines[-1] == '>' }730 tmux.send_keys 2731 tmux.prepare732 end242 unmodified linesmodified:CHANGELOG.md+3 added-2 removed
7 unmodified lines8 9 - 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"`12+- Added `cancel` action which clears the input or closes the finder when the13+ input is already empty14+ - e.g. `export FZF_DEFAULT_OPTS="--bind esc:cancel"`15 - Added `delete-char/eof` action to differentiate `CTRL-D` and `DEL`16 17 ### Minor improvements/fixes18 240 unmodified lines