mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-07 07:31:58 -07:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5759d50d4a | ||
|
e455836cc9 |
@@ -1,6 +1,10 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
0.13.2
|
||||||
|
------
|
||||||
|
- Fixed race condition where preview window is not properly cleared
|
||||||
|
|
||||||
0.13.1
|
0.13.1
|
||||||
------
|
------
|
||||||
- Fixed UI issue with large `--preview` output with many ANSI codes
|
- Fixed UI issue with large `--preview` output with many ANSI codes
|
||||||
|
4
install
4
install
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
[[ "$@" =~ --pre ]] && version=0.13.1 pre=1 ||
|
[[ "$@" =~ --pre ]] && version=0.13.2 pre=1 ||
|
||||||
version=0.13.1 pre=0
|
version=0.13.2 pre=0
|
||||||
|
|
||||||
auto_completion=
|
auto_completion=
|
||||||
key_bindings=
|
key_bindings=
|
||||||
|
@@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
..
|
..
|
||||||
.TH fzf 1 "Jun 2016" "fzf 0.13.1" "fzf - a command-line fuzzy finder"
|
.TH fzf 1 "Jun 2016" "fzf 0.13.2" "fzf - a command-line fuzzy finder"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
fzf - a command-line fuzzy finder
|
fzf - a command-line fuzzy finder
|
||||||
|
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Current version
|
// Current version
|
||||||
version = "0.13.1"
|
version = "0.13.2"
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
coordinatorDelayMax time.Duration = 100 * time.Millisecond
|
coordinatorDelayMax time.Duration = 100 * time.Millisecond
|
||||||
|
@@ -82,6 +82,11 @@ type selectedItem struct {
|
|||||||
|
|
||||||
type byTimeOrder []selectedItem
|
type byTimeOrder []selectedItem
|
||||||
|
|
||||||
|
type previewRequest struct {
|
||||||
|
ok bool
|
||||||
|
str string
|
||||||
|
}
|
||||||
|
|
||||||
func (a byTimeOrder) Len() int {
|
func (a byTimeOrder) Len() int {
|
||||||
return len(a)
|
return len(a)
|
||||||
}
|
}
|
||||||
@@ -908,21 +913,23 @@ func (t *Terminal) Loop() {
|
|||||||
if t.hasPreviewWindow() {
|
if t.hasPreviewWindow() {
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
focused := ""
|
request := previewRequest{false, ""}
|
||||||
t.previewBox.Wait(func(events *util.Events) {
|
t.previewBox.Wait(func(events *util.Events) {
|
||||||
for req, value := range *events {
|
for req, value := range *events {
|
||||||
switch req {
|
switch req {
|
||||||
case reqPreviewEnqueue:
|
case reqPreviewEnqueue:
|
||||||
focused = value.(string)
|
request = value.(previewRequest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
events.Clear()
|
events.Clear()
|
||||||
})
|
})
|
||||||
if len(focused) > 0 {
|
if request.ok {
|
||||||
command := strings.Replace(t.preview.command, "{}", quoteEntry(focused), -1)
|
command := strings.Replace(t.preview.command, "{}", quoteEntry(request.str), -1)
|
||||||
cmd := util.ExecCommand(command)
|
cmd := util.ExecCommand(command)
|
||||||
out, _ := cmd.CombinedOutput()
|
out, _ := cmd.CombinedOutput()
|
||||||
t.reqBox.Set(reqPreviewDisplay, string(out))
|
t.reqBox.Set(reqPreviewDisplay, string(out))
|
||||||
|
} else {
|
||||||
|
t.reqBox.Set(reqPreviewDisplay, "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -936,7 +943,7 @@ func (t *Terminal) Loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
focused := ""
|
focused := previewRequest{false, ""}
|
||||||
for {
|
for {
|
||||||
t.reqBox.Wait(func(events *util.Events) {
|
t.reqBox.Wait(func(events *util.Events) {
|
||||||
defer events.Clear()
|
defer events.Clear()
|
||||||
@@ -953,19 +960,17 @@ func (t *Terminal) Loop() {
|
|||||||
case reqList:
|
case reqList:
|
||||||
t.printList()
|
t.printList()
|
||||||
cnt := t.merger.Length()
|
cnt := t.merger.Length()
|
||||||
|
var currentFocus previewRequest
|
||||||
if cnt > 0 && cnt > t.cy {
|
if cnt > 0 && cnt > t.cy {
|
||||||
currentFocus := t.current()
|
currentFocus = previewRequest{true, t.current()}
|
||||||
if currentFocus != focused {
|
|
||||||
focused = currentFocus
|
|
||||||
if t.isPreviewEnabled() {
|
|
||||||
t.previewBox.Set(reqPreviewEnqueue, focused)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if focused != "" && t.isPreviewEnabled() {
|
currentFocus = previewRequest{false, ""}
|
||||||
t.pwindow.Erase()
|
}
|
||||||
|
if currentFocus != focused {
|
||||||
|
focused = currentFocus
|
||||||
|
if t.isPreviewEnabled() {
|
||||||
|
t.previewBox.Set(reqPreviewEnqueue, focused)
|
||||||
}
|
}
|
||||||
focused = ""
|
|
||||||
}
|
}
|
||||||
case reqJump:
|
case reqJump:
|
||||||
if t.merger.Length() == 0 {
|
if t.merger.Length() == 0 {
|
||||||
@@ -1076,7 +1081,7 @@ func (t *Terminal) Loop() {
|
|||||||
t.resizeWindows()
|
t.resizeWindows()
|
||||||
cnt := t.merger.Length()
|
cnt := t.merger.Length()
|
||||||
if t.previewing && cnt > 0 && cnt > t.cy {
|
if t.previewing && cnt > 0 && cnt > t.cy {
|
||||||
t.previewBox.Set(reqPreviewEnqueue, t.current())
|
t.previewBox.Set(reqPreviewEnqueue, previewRequest{true, t.current()})
|
||||||
}
|
}
|
||||||
req(reqList, reqInfo)
|
req(reqList, reqInfo)
|
||||||
}
|
}
|
||||||
|
@@ -1229,14 +1229,20 @@ class TestGoFZF < TestBase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_preview
|
def test_preview
|
||||||
tmux.send_keys %[seq 1000 | #{FZF} --preview 'echo {{}-{}}' --bind ?:toggle-preview], :Enter
|
tmux.send_keys %[seq 1000 | sed s/^2$// | #{FZF} --preview 'sleep 0.2; echo {{}-{}}' --bind ?:toggle-preview], :Enter
|
||||||
tmux.until { |lines| lines[1].include?(' {1-1}') }
|
tmux.until { |lines| lines[1].include?(' {1-1}') }
|
||||||
|
tmux.send_keys :Up
|
||||||
|
tmux.until { |lines| lines[1].include?(' {-}') }
|
||||||
tmux.send_keys '555'
|
tmux.send_keys '555'
|
||||||
tmux.until { |lines| lines[1].include?(' {555-555}') }
|
tmux.until { |lines| lines[1].include?(' {555-555}') }
|
||||||
tmux.send_keys '?'
|
tmux.send_keys '?'
|
||||||
tmux.until { |lines| !lines[1].include?(' {555-555}') }
|
tmux.until { |lines| !lines[1].include?(' {555-555}') }
|
||||||
tmux.send_keys '?'
|
tmux.send_keys '?'
|
||||||
tmux.until { |lines| lines[1].include?(' {555-555}') }
|
tmux.until { |lines| lines[1].include?(' {555-555}') }
|
||||||
|
tmux.send_keys :BSpace
|
||||||
|
tmux.until { |lines| lines[-2].start_with? ' 28/1000' }
|
||||||
|
tmux.send_keys 'foobar'
|
||||||
|
tmux.until { |lines| !lines[1].include?('{') }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_preview_hidden
|
def test_preview_hidden
|
||||||
|
Reference in New Issue
Block a user