Skip to content

Commit

Permalink
Properly clear list when --header-lines not filled on reload
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Dec 6, 2019
1 parent 1e6ac55 commit 86e3994
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ CHANGELOG
```sh
fzf --multi --bind 'ctrl-l:select-all+execute(less {+f})+deselect-all'
```
- Fixed bugs of reload action
- Not triggered when there's no match even when the command doesn't have
any placeholder expressions
- Screen not properly cleared when `--header-lines` not filled on reload

0.19.0
------
Expand Down
4 changes: 3 additions & 1 deletion src/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ func Run(opts *Options, revision string) {
}

case EvtHeader:
terminal.UpdateHeader(value.([]string))
header := value.([]string)
header = append(header, make([]string, opts.HeaderLines-len(header))...)
terminal.UpdateHeader(header)

case EvtSearchFin:
switch val := value.(type) {
Expand Down
7 changes: 7 additions & 0 deletions test/test_go.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,13 @@ def test_reload_even_when_theres_no_match
tmux.send_keys :Space
tmux.until { |lines| lines.item_count == 10 }
end

def test_clear_list_when_header_lines_changed_due_to_reload
tmux.send_keys %(seq 10 | #{FZF} --header 0 --header-lines 3 --bind 'space:reload(seq 1)'), :Enter
tmux.until { |lines| lines.any? { |line| line.include?('9') } }
tmux.send_keys :Space
tmux.until { |lines| lines.none? { |line| line.include?('9') } }
end
end

module TestShell
Expand Down

0 comments on commit 86e3994

Please sign in to comment.