Add support for ctrl-space key

Close #825
This commit is contained in:
Junegunn Choi 2017-01-28 02:54:47 +09:00
parent 421b9b271a
commit 36dceecd58
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
7 changed files with 11 additions and 0 deletions

View File

@ -12,6 +12,7 @@ CHANGELOG
switching to the alternate screen. This is useful when the process is switching to the alternate screen. This is useful when the process is
short-lived and you're not interested in its output. short-lived and you're not interested in its output.
- e.g. `fzf --bind 'ctrl-y:execute!(echo -n {} | pbcopy)'` - e.g. `fzf --bind 'ctrl-y:execute!(echo -n {} | pbcopy)'`
- `ctrl-space` is allowed in `--bind`
0.16.2 0.16.2
------ ------

View File

@ -426,6 +426,7 @@ e.g. \fBfzf --bind=ctrl-j:accept,ctrl-k:kill-line\fR
.B AVAILABLE KEYS: (SYNONYMS) .B AVAILABLE KEYS: (SYNONYMS)
\fIctrl-[a-z]\fR \fIctrl-[a-z]\fR
\fIctrl-space\fR
\fIalt-[a-z]\fR \fIalt-[a-z]\fR
\fIalt-[0-9]\fR \fIalt-[0-9]\fR
\fIf[1-12]\fR \fIf[1-12]\fR

View File

@ -393,6 +393,8 @@ func parseKeyChords(str string, message string) map[int]string {
chord = tui.AltZ + int(' ') chord = tui.AltZ + int(' ')
case "bspace", "bs": case "bspace", "bs":
chord = tui.BSpace chord = tui.BSpace
case "ctrl-space":
chord = tui.CtrlSpace
case "alt-enter", "alt-return": case "alt-enter", "alt-return":
chord = tui.AltEnter chord = tui.AltEnter
case "alt-space": case "alt-space":

View File

@ -322,6 +322,8 @@ func (r *LightRenderer) GetChar() Event {
return Event{CtrlQ, 0, nil} return Event{CtrlQ, 0, nil}
case 127: case 127:
return Event{BSpace, 0, nil} return Event{BSpace, 0, nil}
case 0:
return Event{CtrlSpace, 0, nil}
case ESC: case ESC:
ev := r.escSequence(&sz) ev := r.escSequence(&sz)
// Second chance // Second chance

View File

@ -475,6 +475,8 @@ func (r *FullscreenRenderer) GetChar() Event {
return escSequence() return escSequence()
case 127: case 127:
return Event{BSpace, 0, nil} return Event{BSpace, 0, nil}
case 0:
return Event{CtrlSpace, 0, nil}
} }
// CTRL-A ~ CTRL-Z // CTRL-A ~ CTRL-Z
if c >= CtrlA && c <= CtrlZ { if c >= CtrlA && c <= CtrlZ {

View File

@ -270,6 +270,8 @@ func (r *FullscreenRenderer) GetChar() Event {
return Event{CtrlY, 0, nil} return Event{CtrlY, 0, nil}
case tcell.KeyCtrlZ: case tcell.KeyCtrlZ:
return Event{CtrlZ, 0, nil} return Event{CtrlZ, 0, nil}
case tcell.KeyCtrlSpace:
return Event{CtrlSpace, 0, nil}
case tcell.KeyBackspace, tcell.KeyBackspace2: case tcell.KeyBackspace, tcell.KeyBackspace2:
if alt { if alt {
return Event{AltBS, 0, nil} return Event{AltBS, 0, nil}

View File

@ -38,6 +38,7 @@ const (
CtrlY CtrlY
CtrlZ CtrlZ
ESC ESC
CtrlSpace
Invalid Invalid
Resize Resize