summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Walker <walker@pobox.com>2017-07-06 13:04:35 -0400
committerJonas Fonseca <jonas.fonseca@gmail.com>2017-07-06 15:22:15 -0400
commit809a2aff5dbfda2b45ba3e8acb6aad01fefd831f (patch)
tree027dc6417f2b38ea531898d0a118f2b1446df665
parent4e4828a5e89f21394035865dc712e56d9340adb0 (diff)
allow Ctrl-C to terminate file-finder prompt
-rw-r--r--src/ui.c6
-rwxr-xr-xtest/help/all-keybindings-test.expected6
-rwxr-xr-xtest/help/default-test4
-rwxr-xr-xtest/help/user-command-test6
-rw-r--r--tigrc1
5 files changed, 15 insertions, 8 deletions
diff --git a/src/ui.c b/src/ui.c
index 40cc7b17..26842aae 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -256,6 +256,12 @@ file_finder_input_handler(struct input *input, struct key *key)
file_finder_draw(finder);
return INPUT_SKIP;
+ case REQ_BACK:
+ case REQ_PARENT:
+ case REQ_VIEW_CLOSE:
+ case REQ_VIEW_CLOSE_NO_QUIT:
+ return INPUT_CANCEL;
+
default:
if (key_to_value(key) == 0) {
argv_append(&finder->search, key->data.bytes);
diff --git a/test/help/all-keybindings-test.expected b/test/help/all-keybindings-test.expected
index 0b608291..f6b6b44c 100755
--- a/test/help/all-keybindings-test.expected
+++ b/test/help/all-keybindings-test.expected
@@ -68,6 +68,8 @@ Option toggling:
$ :toggle commit-title-overflow
% :toggle file-filter
[-] search bindings
+View manipulation
+ <Ctrl-C> view-close Close the current view
Searching
<Down>, <Ctrl-N>, <Ctrl-J> find-next Find next search match
<Up>, <Ctrl-P>, <Ctrl-K> find-prev Find previous search match
@@ -114,6 +116,4 @@ External commands:
-
-
-[help] - line 1 of 112 100%
+[help] - line 1 of 114 100%
diff --git a/test/help/default-test b/test/help/default-test
index 21012f68..7ddeef45 100755
--- a/test/help/default-test
+++ b/test/help/default-test
@@ -51,7 +51,7 @@ View manipulation
O maximize Maximize the current view
q view-close Close the current view
Q, <Ctrl-C> quit Close all views and quit
-[help] - line 1 of 112 25%
+[help] - line 1 of 114 24%
EOF
assert_equals 'help-search.screen' <<EOF
@@ -83,7 +83,7 @@ View manipulation
O maximize Maximize the current view
q view-close Close the current view
Q, <Ctrl-C> quit Close all views and quit
-[help] - line 18 of 112 25%
+[help] - line 18 of 114 24%
EOF
assert_equals 'help-collapsed.screen' <<EOF
diff --git a/test/help/user-command-test b/test/help/user-command-test
index 3b308b06..3c384609 100755
--- a/test/help/user-command-test
+++ b/test/help/user-command-test
@@ -47,13 +47,13 @@ External commands:
cc !git commit
ca @?git commit --amend --no-edit
[-] search bindings
+View manipulation
+ <Ctrl-C> view-close Close the current view
Searching
<Down>, <Ctrl-N>, <Ctrl-J> find-next Find next search match
<Up>, <Ctrl-P>, <Ctrl-K> find-prev Find previous search match
[-] main bindings
Cursor navigation
G move-last-line Move cursor to last line
-Option toggling:
- F :toggle commit-title-refs
-[help] - line 78 of 138 76%
+[help] - line 78 of 140 75%
EOF
diff --git a/tigrc b/tigrc
index f699eaab..29c6baf6 100644
--- a/tigrc
+++ b/tigrc
@@ -254,6 +254,7 @@ bind search <C-J> find-next
bind search <Up> find-prev
bind search <C-P> find-prev
bind search <C-K> find-prev
+bind search <C-C> view-close
# Option manipulation
bind generic o options # Open the options menu