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
short-lived and you're not interested in its output.
- e.g. `fzf --bind 'ctrl-y:execute!(echo -n {} | pbcopy)'`
- `ctrl-space` is allowed in `--bind`
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)
\fIctrl-[a-z]\fR
\fIctrl-space\fR
\fIalt-[a-z]\fR
\fIalt-[0-9]\fR
\fIf[1-12]\fR

View File

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

View File

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

View File

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

View File

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

View File

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