Add `close` action
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Close #2331
authored by Junegunn Choi · committed by Junegunn Choi · parent d110372 · Browse files · 6 files·+30 added−2 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+30 added−2 removed
- tests:+13 added−0 removed
- other:+17 added−2 removed
Provenance
- Commit
f55c990- Tree
71bfaa5- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
d110372
6 files changed+30 added−2 removed
modified:man/man1/fzf-tmux.1+1 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-tmux 1 "Jan 2021" "fzf 0.25.0" "fzf-tmux - open fzf in tmux split pane"24+.TH fzf-tmux 1 "Feb 2021" "fzf 0.25.1" "fzf-tmux - open fzf in tmux split pane"25 26 .SH NAME27 fzf-tmux - open fzf in tmux split pane28 40 unmodified linesmodified:man/man1/fzf.1+2 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 "Jan 2021" "fzf 0.25.0" "fzf - a command-line fuzzy finder"24+.TH fzf 1 "Feb 2021" "fzf 0.25.1" "fzf - a command-line fuzzy finder"25 26 .SH NAME27 fzf - a command-line fuzzy finder28 750 unmodified lines779 \fBcancel\fR (clear query string if not empty, abort fzf otherwise)780 \fBchange-prompt(...)\fR (change prompt to the given string)781 \fBclear-screen\fR \fIctrl-l\fR782 \fBclear-selection\fR (clear multi-selection)783+ \fBclose\fR (close preview window if open, abort fzf otherwise)784 \fBclear-query\fR (clear query string)785 \fBdelete-char\fR \fIdel\fR786 \fBdelete-char/eof\fR \fIctrl-d\fR (same as \fBdelete-char\fR except aborts fzf if query is empty)787 \fBdeselect-all\fR (deselect all matches)167 unmodified linesmodified:src/options.go+2 added
881 unmodified lines882 case "select-all":883 appendAction(actSelectAll)884 case "deselect-all":885 appendAction(actDeselectAll)886+ case "close":887+ appendAction(actClose)888 case "toggle":889 appendAction(actToggle)890 case "down":891 appendAction(actDown)710 unmodified linesmodified:src/terminal.go+7 added
219 unmodified lines220 actChangePrompt221 actClearScreen222 actClearQuery223 actClearSelection224+ actClose225 actDeleteChar226 actDeleteCharEOF227 actEndOfLine228 actForwardChar2105 unmodified lines2334 t.deselectItem(t.merger.Get(i).item)2335 }2336 req(reqList, reqInfo)2337 }2338+ case actClose:2339+ if t.isPreviewEnabled() {2340+ togglePreview(false)2341+ } else {2342+ req(reqQuit)2343+ }2344 case actToggle:2345 if t.multi > 0 && t.merger.Length() > 0 && toggle() {2346 req(reqList)2347 }340 unmodified linesmodified:test/test_go.rb+13 added
1875 unmodified lines1876 end1877 tmux.send_keys 'C-w'1878 end1879 end1880+1881+ def test_close1882+ tmux.send_keys "seq 100 | #{FZF} --preview 'echo foo' --bind ctrl-c:close", :Enter1883+ tmux.until { |lines| assert_equal 100, lines.match_count }1884+ tmux.until { |lines| assert_includes lines[1], 'foo' }1885+ tmux.send_keys 'C-c'1886+ tmux.until { |lines| refute_includes lines[1], 'foo' }1887+ tmux.send_keys '10'1888+ tmux.until { |lines| assert_equal 2, lines.match_count }1889+ tmux.send_keys 'C-c'1890+ tmux.send_keys 'C-l', 'closed'1891+ tmux.until { |lines| assert_includes lines[0], 'closed' }1892+ end1893 end1894 1895 module TestShell1896 def setup478 unmodified linesmodified:CHANGELOG.md+5 added
1 CHANGELOG2 =========3 4+0.25.15+------6+- Added `close` action7+ - Close preview window if open, abort fzf otherwise8+9 0.25.010 ------11 - Text attributes set in `--color` are not reset when fzf sees another12 `--color` option for the same element. This allows you to put custom text1069 unmodified lines