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.
This commit is contained in:
Junegunn Choi
2023-05-05 15:08:08 +09:00
parent e619b7c4f4
commit 94999101e3
3 changed files with 45 additions and 9 deletions

View File

@@ -3523,6 +3523,9 @@ func (t *Terminal) Loop() {
// Split window options
tokens := strings.Split(a.a, "|")
if len(tokens[0]) > 0 && t.initialPreviewOpts.hidden {
t.previewOpts.hidden = false
}
parsePreviewWindow(&t.previewOpts, tokens[0])
if len(tokens) > 1 {
a.a = strings.Join(append(tokens[1:], tokens[0]), "|")