Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative keys for Ctrl-W & Page-Down #238

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ TESTS=tests/01.t tests/02.t tests/03.t tests/04.t tests/05.t tests/06.t \
tests/37.t tests/38.t tests/39.t tests/40.t tests/41.t tests/42.t \
tests/43.t tests/44.t tests/45.t tests/46.t tests/47.t tests/48.t \
tests/49.t tests/50.t tests/51.t tests/52.t tests/53.t tests/54.t \
tests/55.t tests/56.t tests/57.t tests/58.t tests/59.t tests/60.t
tests/55.t tests/56.t tests/57.t tests/58.t tests/59.t tests/60.t \
tests/61.t tests/62.t tests/63.t tests/64.t tests/65.t tests/66.t \
tests/67.t
TEST_EXTENSIONS=.t
T_LOG_COMPILER=$(top_srcdir)/tests/pick-test.sh
AM_COLOR_TESTS=no
Expand Down
4 changes: 2 additions & 2 deletions pick.1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Exit with a erroneous status without outputting the selected choice.
Redraw interface with respect to the current size of the terminal.
.It Ic Up/Down | Ctrl-P/Ctrl-N
Select between choices matching the current search query.
.It Ic Page-Down/Page-Up | Ctrl-V/Alt-V
.It Ic Page-Down/Page-Up | Ctrl-V/Alt-V | Alt-Space
Move the selection to the choice located one page down/up from the currently
selected choice.
.It Ic Home/End | Alt-</Alt->
Expand All @@ -73,7 +73,7 @@ Move the cursor to the end of the line in the search query input field.
Delete one character to the left of the cursor in the search query input field.
.It Ic Delete | Ctrl-D
Delete the character under the cursor in the search query input field.
.It Ic Ctrl-W
.It Ic Alt-Backspace | Ctrl-W
Delete the word to the left of the cursor.
A word is recognized as a sequence of characters for which either
.Xr isalnum 3
Expand Down
3 changes: 3 additions & 0 deletions pick.c
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ get_key(char *buf, size_t size, size_t *nread)
KEY(CTRL_L, "\014"),
KEY(CTRL_U, "\025"),
KEY(CTRL_W, "\027"),
KEY(CTRL_W, "\033\177"),
KEY(CTRL_W, "\033\b"),
CAP(DEL, "kdch1"),
KEY(DEL, "\004"),
CAP(END, "kend"),
Expand All @@ -922,6 +924,7 @@ get_key(char *buf, size_t size, size_t *nread)
KEY(LINE_UP, "\020"),
CAP(PAGE_DOWN, "knp"),
KEY(PAGE_DOWN, "\026"),
KEY(PAGE_DOWN, "\033 "),
CAP(PAGE_UP, "kpp"),
KEY(PAGE_UP, "\033v"),
CAP(RIGHT, "kcuf1"),
Expand Down
7 changes: 7 additions & 0 deletions tests/61.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: Alt-Backspace alias for UTF-8 delete word
keys: aa\\ Åå \033\b aa\\ aa \n # ALT_BACKSPACE ENTER
stdin:
aa Åå aa
aa Åå aa aa
stdout:
aa Åå aa aa
7 changes: 7 additions & 0 deletions tests/62.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: Alt-Backspace alias for delete words
keys: \027 ab\\ cd \033\b \033\b \n # ALT_BACKSPACE ALT_BACKSPACE ENTER
stdin:
ab
ab cd
stdout:
ab
7 changes: 7 additions & 0 deletions tests/63.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: non alphanumeric characters are not recognized as part of a word (Alt-Backspace alias)
keys: a/a \033\b a/a \n # ALT_BACKSPACE ENTER
stdin:
a/a
a/a/a
stdout:
a/a/a
7 changes: 7 additions & 0 deletions tests/64.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: underscore is recognized as part of a word (Alt-Backspace alias)
keys: aa_aa \033\b bb \n # ALT_BACKSPACE ENTER
stdin:
aa_aa_bb
bb
stdout:
bb
11 changes: 11 additions & 0 deletions tests/65.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: Alt-Space alias for page down
keys: \033\\ \n # PAGE_DOWN ENTER
env: LINES=5
stdin:
01
02
03
04
05
stdout:
05
11 changes: 11 additions & 0 deletions tests/66.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: Alt-Space alias for page down, first choice not selected
keys: \016 \033\\ \n # DOWN PAGE_DOWN ENTER
stdin:
01
02
03
04
05
06
stdout:
06
10 changes: 10 additions & 0 deletions tests/67.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
description: Alt-Space alias for page down, all choices fit on one page
keys: \033\\ \n # PAGE_DOWN ENTER
env: LINES=5
stdin:
01
02
03
04
stdout:
04