mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-18 00:03:39 -05:00
Add 'show-preview' and 'hide-preview'
For cases where 'toggle-preview' is not enough
This commit is contained in:
@@ -1111,6 +1111,10 @@ func parseActionList(masked string, original string, prevActions []*action, putA
|
||||
appendAction(actPrevSelected)
|
||||
case "next-selected":
|
||||
appendAction(actNextSelected)
|
||||
case "show-preview":
|
||||
appendAction(actShowPreview)
|
||||
case "hide-preview":
|
||||
appendAction(actHidePreview)
|
||||
case "toggle-preview":
|
||||
appendAction(actTogglePreview)
|
||||
case "toggle-preview-wrap":
|
||||
|
||||
@@ -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