diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2023-05-05 15:08:08 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-05-05 15:33:03 +0900 |
commit | 94999101e358385f3ca67a6ec9512f549196b802 (patch) | |
tree | 1b2bab23c86aeaa4aaaceb95396e22a113e2c7f7 /src/options.go | |
parent | e619b7c4f4e0da09b87a239b8f52ad909bb5f1e0 (diff) |
Fix the behavior of change-preview-window action (#3280)
* change-preview-window restores the initial preview window options,
and overrides the properties that are specified
* However, 'hidden' property is treated differently. It is set to
'false' if the specified properties of the action is non-empty.
* cf. toggle-preview takes the "current" preview window options and
toggles the 'hidden' property.
Diffstat (limited to 'src/options.go')
-rw-r--r-- | src/options.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/options.go b/src/options.go index 6f6b25e8..27e32d13 100644 --- a/src/options.go +++ b/src/options.go @@ -1969,25 +1969,25 @@ func postProcessOptions(opts *Options) { // Extend the default key map keymap := defaultKeymap() for key, actions := range opts.Keymap { - var lastChangePreviewWindow *action + reordered := []*action{} for _, act := range actions { switch act.t { case actToggleSort: // To display "+S"/"-S" on info line opts.ToggleSort = true - case actChangePreviewWindow: - lastChangePreviewWindow = act + case actTogglePreview, actShowPreview, actHidePreview, actChangePreviewWindow: + reordered = append(reordered, act) } } - // Re-organize actions so that we only keep the last change-preview-window - // and it comes first in the list. + // Re-organize actions so that we put actions that change the preview window first in the list. // * change-preview-window(up,+10)+preview(sleep 3; cat {})+change-preview-window(up,+20) - // -> change-preview-window(up,+20)+preview(sleep 3; cat {}) - if lastChangePreviewWindow != nil { - reordered := []*action{lastChangePreviewWindow} + // -> change-preview-window(up,+10)+change-preview-window(up,+20)+preview(sleep 3; cat {}) + if len(reordered) > 0 { for _, act := range actions { - if act.t != actChangePreviewWindow { + switch act.t { + case actTogglePreview, actShowPreview, actHidePreview, actChangePreviewWindow: + default: reordered = append(reordered, act) } } |