mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 15:23:48 -05:00
Fix a bug where you cannot unset the default --nth using change-nth
This commit is contained in:
@@ -4,6 +4,7 @@ CHANGELOG
|
||||
0.65.1
|
||||
------
|
||||
- Fixed incorrect `$FZF_CLICK_HEADER_WORD` and `$FZF_CLICK_FOOTER_WORD` when the header or footer contains ANSI escape sequences and tab characters.
|
||||
- Fixed a bug where you cannot unset the default `--nth` using `change-nth` action.
|
||||
|
||||
0.65.0
|
||||
------
|
||||
|
||||
@@ -5726,7 +5726,7 @@ func (t *Terminal) Loop() error {
|
||||
capture(true, func(expr string) {
|
||||
// Split nth expression
|
||||
tokens := strings.Split(expr, "|")
|
||||
if nth, err := splitNth(tokens[0]); err == nil {
|
||||
if nth, err := splitNth(tokens[0]); err == nil || len(expr) == 0 {
|
||||
// Changed
|
||||
newNth = &nth
|
||||
} else {
|
||||
|
||||
@@ -2045,4 +2045,19 @@ class TestCore < TestInteractive
|
||||
tmux.send_keys :b
|
||||
tmux.until { |lines| assert_includes lines, '> 9' }
|
||||
end
|
||||
|
||||
def test_change_nth_unset_default
|
||||
tmux.send_keys %(echo foo bar | #{FZF} --nth 2 --query fb --bind space:change-nth:), :Enter
|
||||
tmux.until do
|
||||
assert_equal 1, it.item_count
|
||||
assert_equal 0, it.match_count
|
||||
end
|
||||
|
||||
tmux.send_keys :Space
|
||||
|
||||
tmux.until do
|
||||
assert_equal 1, it.item_count
|
||||
assert_equal 1, it.match_count
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user