mirror of
https://github.com/junegunn/fzf.git
synced 2026-05-04 12:55:53 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b4a86a9c8a |
@@ -1,6 +1,11 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
0.73.0
|
||||
------
|
||||
- Bug fixes
|
||||
- `change-preview-window` no longer resets `wrap` / `wrap-word` state set via `toggle-preview-wrap` / `toggle-preview-wrap-word`. Layout fields still snap to the preset, so cycling and the empty-token reset behave as before. The new spec can still override by including `wrap` or `nowrap` explicitly. (#4791)
|
||||
|
||||
0.72.0
|
||||
------
|
||||
_Release highlights: https://junegunn.github.io/fzf/releases/0.72.0/_
|
||||
|
||||
@@ -4,7 +4,7 @@ require (
|
||||
github.com/charlievieth/fastwalk v1.0.14
|
||||
github.com/gdamore/tcell/v2 v2.9.0
|
||||
github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741
|
||||
github.com/mattn/go-isatty v0.0.22
|
||||
github.com/mattn/go-isatty v0.0.20
|
||||
github.com/rivo/uniseg v0.4.7
|
||||
golang.org/x/sys v0.35.0
|
||||
golang.org/x/term v0.34.0
|
||||
|
||||
@@ -8,8 +8,8 @@ github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741 h1:7dYDtfMD
|
||||
github.com/junegunn/go-shellwords v0.0.0-20250127100254-2aa3b3277741/go.mod h1:6EILKtGpo5t+KLb85LNZLAF6P9LKp78hJI80PXMcn3c=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
|
||||
github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
@@ -33,6 +33,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
|
||||
@@ -7819,6 +7819,11 @@ func (t *Terminal) Loop() error {
|
||||
t.previewOpts = t.initialPreviewOpts
|
||||
t.previewOpts.command = currentPreviewOpts.command
|
||||
|
||||
// Carry over toggle-driven state so toggle-preview-wrap survives
|
||||
// a change-preview-window. Tokens below can still override.
|
||||
t.previewOpts.wrap = currentPreviewOpts.wrap
|
||||
t.previewOpts.wrapWord = currentPreviewOpts.wrapWord
|
||||
|
||||
// Split window options
|
||||
tokens := strings.Split(a.a, "|")
|
||||
if len(tokens[0]) > 0 && t.initialPreviewOpts.hidden {
|
||||
|
||||
@@ -383,6 +383,49 @@ class TestPreview < TestInteractive
|
||||
end
|
||||
end
|
||||
|
||||
def test_change_preview_window_preserves_wrap_toggle
|
||||
# https://github.com/junegunn/fzf/issues/4791
|
||||
tmux.send_keys "#{FZF} --preview 'for i in $(seq $FZF_PREVIEW_COLUMNS); do echo -n .; done; echo -n .; echo wrapped; echo 2nd line' " \
|
||||
"--preview-window 'right,nowrap,border-rounded' " \
|
||||
'--bind ctrl-w:toggle-preview-wrap ' \
|
||||
'--bind ctrl-r:change-preview-window:border-bold', :Enter
|
||||
sleep 2
|
||||
# Initial: nowrap, rounded border. The long line is truncated; "wrapped" is hidden.
|
||||
tmux.until do |lines|
|
||||
assert_includes lines[2], '2nd line'
|
||||
assert(lines.any? { it.include?('╭') })
|
||||
end
|
||||
# Toggle wrap on.
|
||||
tmux.send_keys 'C-w'
|
||||
tmux.until do |lines|
|
||||
assert_includes lines[2], 'wrapped'
|
||||
assert_includes lines[3], '2nd line'
|
||||
end
|
||||
# change-preview-window swaps the border to bold; wrap state must persist.
|
||||
tmux.send_keys 'C-r'
|
||||
tmux.until do |lines|
|
||||
assert(lines.any? { it.include?('┏') }) # border actually changed
|
||||
refute(lines.any? { it.include?('╭') })
|
||||
assert_includes lines[2], 'wrapped' # wrap was preserved
|
||||
assert_includes lines[3], '2nd line'
|
||||
end
|
||||
end
|
||||
|
||||
def test_change_preview_window_overrides_wrap_explicitly
|
||||
# When the new spec sets wrap/nowrap explicitly, it should still win.
|
||||
tmux.send_keys "#{FZF} --preview 'for i in $(seq $FZF_PREVIEW_COLUMNS); do echo -n .; done; echo -n .; echo wrapped; echo 2nd line' " \
|
||||
"--preview-window 'right,wrap' " \
|
||||
'--bind ctrl-r:change-preview-window:nowrap', :Enter
|
||||
# Initial: wrap is on.
|
||||
tmux.until do |lines|
|
||||
assert_includes lines[2], 'wrapped'
|
||||
assert_includes lines[3], '2nd line'
|
||||
end
|
||||
# Explicit nowrap in the spec must override the (initially wrapped) state.
|
||||
tmux.send_keys 'C-r'
|
||||
tmux.until { |lines| assert_includes lines[2], '2nd line' }
|
||||
end
|
||||
|
||||
def test_preview_follow_wrap
|
||||
tmux.send_keys "seq 1 | #{FZF} --preview 'seq 1000' --preview-window right,2,follow,wrap", :Enter
|
||||
tmux.until { |lines| assert_equal 1, lines.match_count }
|
||||
|
||||
Reference in New Issue
Block a user