mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-06 15:12:05 -07:00
Add 'show-preview' and 'hide-preview'
For cases where 'toggle-preview' is not enough
This commit is contained in:
@@ -350,6 +350,8 @@ const (
|
||||
actRefreshPreview
|
||||
actReplaceQuery
|
||||
actToggleSort
|
||||
actShowPreview
|
||||
actHidePreview
|
||||
actTogglePreview
|
||||
actTogglePreviewWrap
|
||||
actTransformBorderLabel
|
||||
@@ -2866,8 +2868,17 @@ func (t *Terminal) Loop() {
|
||||
case actInvalid:
|
||||
t.mutex.Unlock()
|
||||
return false
|
||||
case actTogglePreview:
|
||||
if t.hasPreviewWindow() || len(t.previewOpts.command) > 0 {
|
||||
case actTogglePreview, actShowPreview, actHidePreview:
|
||||
var act bool
|
||||
switch a.t {
|
||||
case actShowPreview:
|
||||
act = !t.hasPreviewWindow() && len(t.previewOpts.command) > 0
|
||||
case actHidePreview:
|
||||
act = t.hasPreviewWindow()
|
||||
case actTogglePreview:
|
||||
act = t.hasPreviewWindow() || len(t.previewOpts.command) > 0
|
||||
}
|
||||
if act {
|
||||
t.activePreviewOpts.Toggle()
|
||||
updatePreviewWindow(false)
|
||||
if t.isPreviewEnabled() {
|
||||
|
Reference in New Issue
Block a user