Add support for alt-{up,down,left,right} keys
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Close #1234
authored by Junegunn Choi · committed by Junegunn Choi · parent 7add751 · Browse files · 5 files·+48 added−1 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+48 added−1 removed
- other:+48 added−1 removed
Provenance
- Commit
7dbbbef- Tree
3db3e3e- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
7add751
5 files changed+48 added−1 removed
modified:man/man1/fzf.1+5 added-1 removed
19 unmodified lines20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN22 THE SOFTWARE.23 ..24-.TH fzf 1 "Feb 2018" "fzf 0.17.4-devel" "fzf - a command-line fuzzy finder"24+.TH fzf 1 "Apr 2018" "fzf 0.17.4-devel" "fzf - a command-line fuzzy finder"25 26 .SH NAME27 fzf - a command-line fuzzy finder28 434 unmodified lines463 \fIf[1-12]\fR464 \fIenter\fR (\fIreturn\fR \fIctrl-m\fR)465 \fIspace\fR466 \fIbspace\fR (\fIbs\fR)467+ \fIalt-up\fR468+ \fIalt-down\fR469+ \fIalt-left\fR470+ \fIalt-right\fR471 \fIalt-enter\fR472 \fIalt-space\fR473 \fIalt-bspace\fR (\fIalt-bs\fR)474 \fIalt-/\fR141 unmodified linesmodified:src/tui/light.go+18 added
358 unmodified lines359 *sz = 2360 if r.buffer[1] >= 1 && r.buffer[1] <= 'z'-'a'+1 {361 return Event{int(CtrlAltA + r.buffer[1] - 1), 0, nil}362 }363+ alt := false364+ if len(r.buffer) > 2 && r.buffer[1] == ESC {365+ r.buffer = r.buffer[1:]366+ alt = true367+ }368 switch r.buffer[1] {369 case 32:370 return Event{AltSpace, 0, nil}371 case 47:12 unmodified lines384 }385 *sz = 3386 switch r.buffer[2] {387 case 68:388+ if alt {389+ return Event{AltLeft, 0, nil}390+ }391 return Event{Left, 0, nil}392 case 67:393+ if alt {394+ // Ugh..395+ return Event{AltRight, 0, nil}396+ }397 return Event{Right, 0, nil}398 case 66:399+ if alt {400+ return Event{AltDown, 0, nil}401+ }402 return Event{Down, 0, nil}403 case 65:404+ if alt {405+ return Event{AltUp, 0, nil}406+ }407 return Event{Up, 0, nil}408 case 90:409 return Event{BTab, 0, nil}410 case 72:515 unmodified linesmodified:src/tui/tcell.go+12 added
293 unmodified lines294 }295 return Event{BSpace, 0, nil}296 297 case tcell.KeyUp:298+ if alt {299+ return Event{AltUp, 0, nil}300+ }301 return Event{Up, 0, nil}302 case tcell.KeyDown:303+ if alt {304+ return Event{AltDown, 0, nil}305+ }306 return Event{Down, 0, nil}307 case tcell.KeyLeft:308+ if alt {309+ return Event{AltLeft, 0, nil}310+ }311 return Event{Left, 0, nil}312 case tcell.KeyRight:313+ if alt {314+ return Event{AltRight, 0, nil}315+ }316 return Event{Right, 0, nil}317 318 case tcell.KeyHome:319 return Event{Home, 0, nil}279 unmodified linesmodified:src/tui/tui.go+5 added
83 unmodified lines84 AltSpace85 AltSlash86 AltBS87 88+ AltUp89+ AltDown90+ AltLeft91+ AltRight92+93 Alt094 )95 96 const ( // Reset iota335 unmodified linesmodified:src/options.go+8 added
408 unmodified lines409 case "alt-/":410 chord = tui.AltSlash411 case "alt-bs", "alt-bspace":412 chord = tui.AltBS413+ case "alt-up":414+ chord = tui.AltUp415+ case "alt-down":416+ chord = tui.AltDown417+ case "alt-left":418+ chord = tui.AltLeft419+ case "alt-right":420+ chord = tui.AltRight421 case "tab":422 chord = tui.Tab423 case "btab", "shift-tab":424 chord = tui.BTab851 unmodified lines