Compare commits

...

3 Commits

Author SHA1 Message Date
dependabot[bot] 463a48c140 Bump actions/dependency-review-action from 4 to 5
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4 to 5.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](https://github.com/actions/dependency-review-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/dependency-review-action
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-11 21:30:28 +00:00
Junegunn Choi 263eb4732f Strip UTF-8-encoded C1 control characters from rendered items
CodeQL / Analyze (go) (push) Has been cancelled
build / build (push) Has been cancelled
Test fzf on macOS / build (push) Has been cancelled
The display sanitizer already stripped raw 8-bit C1 bytes (0x80-0x9F)
because they decode to RuneError as standalone bytes. Their valid UTF-8
encodings (0xC2 0x80 .. 0xC2 0x9F) decode to the same code points but
were passed through, allowing a filename or input line containing CSI
(U+009B), OSC (U+009D), or DCS (U+0090) to inject terminal control
sequences when rendered.
2026-05-05 09:56:59 +09:00
Junegunn Choi b4a86a9c8a Preserve wrap state across change-preview-window
CodeQL / Analyze (go) (push) Has been cancelled
build / build (push) Has been cancelled
Test fzf on macOS / build (push) Has been cancelled
toggle-preview-wrap (and -wrap-word) modifies t.activePreviewOpts.wrap,
but change-preview-window resets t.previewOpts to t.initialPreviewOpts,
discarding the user's toggle. Carry wrap and wrapWord over so toggles
survive a layout change. Explicit wrap / nowrap tokens in the new spec
still win, so cycling and the empty-token reset are unaffected.

Close #4791
2026-05-02 15:40:41 +09:00
5 changed files with 56 additions and 2 deletions
+1 -1
View File
@@ -11,4 +11,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v5
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
uses: actions/dependency-review-action@v5
+5
View File
@@ -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/_
+5
View File
@@ -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 {
+2 -1
View File
@@ -67,7 +67,8 @@ func (r *LightRenderer) stderrInternal(str string, allowNLCR bool, resetCode str
for len(bytes) > 0 {
r, sz := utf8.DecodeRune(bytes)
nlcr := r == '\n' || r == '\r'
if r >= 32 || r == '\x1b' || nlcr {
isC1 := r >= 0x80 && r <= 0x9F
if (r >= 32 && !isC1) || r == '\x1b' || nlcr {
if nlcr && !allowNLCR {
if r == '\r' {
runes = append(runes, []rune(CR+resetCode)...)
+43
View File
@@ -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 }