Skip to content

Commit

Permalink
allow Ctrl-C to terminate file-finder prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandwalker authored and jonas committed Jul 6, 2017
1 parent 4e4828a commit 809a2af
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions test/help/all-keybindings-test.expected
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -114,6 +116,4 @@ External commands:





[help] - line 1 of 112 100%
[help] - line 1 of 114 100%
4 changes: 2 additions & 2 deletions test/help/default-test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/help/user-command-test
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions tigrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 809a2af

Please sign in to comment.