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
This commit is contained in:
Junegunn Choi
2026-05-02 15:40:41 +09:00
parent 6fefe02546
commit b4a86a9c8a
3 changed files with 53 additions and 0 deletions
+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 {