mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-22 12:55:17 +00:00
Replace eof action with cancel (#289)
This commit is contained in:
parent
f9136cffe6
commit
fdbf3d3fec
@ -9,8 +9,9 @@ CHANGELOG
|
||||
- Added options for sticky header
|
||||
- `--header-file`
|
||||
- `--header-lines`
|
||||
- Added `eof` action which closes the finder only when the input is empty
|
||||
- e.g. `export FZF_DEFAULT_OPTS="--bind esc:eof"`
|
||||
- Added `cancel` action which clears the input or closes the finder when the
|
||||
input is already empty
|
||||
- e.g. `export FZF_DEFAULT_OPTS="--bind esc:cancel"`
|
||||
- Added `delete-char/eof` action to differentiate `CTRL-D` and `DEL`
|
||||
|
||||
### Minor improvements/fixes
|
||||
|
@ -188,13 +188,13 @@ e.g. \fBfzf --bind=ctrl-j:accept,ctrl-k:kill-line\fR
|
||||
\fBbackward-kill-word\fR \fIalt-bs\fR
|
||||
\fBbackward-word\fR \fIalt-b shift-left\fR
|
||||
\fBbeginning-of-line\fR \fIctrl-a home\fR
|
||||
\fBcancel\fR
|
||||
\fBclear-screen\fR \fIctrl-l\fR
|
||||
\fBdelete-char\fR \fIdel\fR
|
||||
\fBdelete-char/eof\fR \fIctrl-d\fR
|
||||
\fBdeselect-all\fR
|
||||
\fBdown\fR \fIctrl-j ctrl-n down\fR
|
||||
\fBend-of-line\fR \fIctrl-e end\fR
|
||||
\fBeof\fR
|
||||
\fBexecute(...)\fR (see below for the details)
|
||||
\fBforward-char\fR \fIctrl-f right\fR
|
||||
\fBforward-word\fR \fIalt-f shift-right\fR
|
||||
|
@ -501,8 +501,8 @@ func parseKeymap(keymap map[int]actionType, execmap map[int]string, toggleSort b
|
||||
keymap[key] = actDeleteCharEof
|
||||
case "end-of-line":
|
||||
keymap[key] = actEndOfLine
|
||||
case "eof":
|
||||
keymap[key] = actEof
|
||||
case "cancel":
|
||||
keymap[key] = actCancel
|
||||
case "forward-char":
|
||||
keymap[key] = actForwardChar
|
||||
case "forward-word":
|
||||
|
@ -100,11 +100,11 @@ const (
|
||||
actBackwardChar
|
||||
actBackwardDeleteChar
|
||||
actBackwardWord
|
||||
actCancel
|
||||
actClearScreen
|
||||
actDeleteChar
|
||||
actDeleteCharEof
|
||||
actEndOfLine
|
||||
actEof
|
||||
actForwardChar
|
||||
actForwardWord
|
||||
actKillLine
|
||||
@ -817,9 +817,13 @@ func (t *Terminal) Loop() {
|
||||
}
|
||||
case actEndOfLine:
|
||||
t.cx = len(t.input)
|
||||
case actEof:
|
||||
case actCancel:
|
||||
if len(t.input) == 0 {
|
||||
req(reqQuit)
|
||||
} else {
|
||||
t.yanked = t.input
|
||||
t.input = []rune{}
|
||||
t.cx = 0
|
||||
}
|
||||
case actForwardChar:
|
||||
if t.cx < len(t.input) {
|
||||
|
@ -718,14 +718,14 @@ class TestGoFZF < TestBase
|
||||
end
|
||||
end
|
||||
|
||||
def test_eof
|
||||
tmux.send_keys "seq 100 | #{fzf "--bind 2:eof"}", :Enter
|
||||
tmux.until { |lines| lines[-2].include?('100/100') }
|
||||
def test_canel
|
||||
tmux.send_keys "seq 10 | #{fzf "--bind 2:cancel"}", :Enter
|
||||
tmux.until { |lines| lines[-2].include?('10/10') }
|
||||
tmux.send_keys '123'
|
||||
tmux.until do |lines|
|
||||
lines[-1] == '> 13' && lines[-2].include?('1/100')
|
||||
end
|
||||
tmux.send_keys :BSpace, :BSpace
|
||||
tmux.until { |lines| lines[-1] == '> 3' && lines[-2].include?('1/10') }
|
||||
tmux.send_keys 'C-y', 'C-y'
|
||||
tmux.until { |lines| lines[-1] == '> 311' }
|
||||
tmux.send_keys 2
|
||||
tmux.until { |lines| lines[-1] == '>' }
|
||||
tmux.send_keys 2
|
||||
tmux.prepare
|
||||
|
Loading…
Reference in New Issue
Block a user