Skip to content
Myr

Enable preview if 'transform' action is bound to a key

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent d210660 · Browse files · 1 file+11 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−4 removed

  • other:+11 added−4 removed

1 file+11 added−4 removed

modified:src/terminal.go+11 added-4 removed
585 unmodified lines
586func trimQuery(query string) []rune {587 return []rune(strings.Replace(query, "\t", " ", -1))588}589590func hasPreviewAction(opts *Options) bool {590func mayTriggerPreview(opts *Options) bool {591 if opts.ListenAddr != nil {592 return true593 }594 for _, actions := range opts.Keymap {595 for _, action := range actions {593 if action.t == actPreview || action.t == actChangePreview {596 switch action.t {597 case actPreview, actChangePreview, actTransform:598 return true599 }600 }601 }
30 unmodified lines
632 } else {633 delay = initialDelay634 }635 var previewBox *util.EventBox632 // We need to start previewer if HTTP server is enabled even when --preview option is not specified633 if len(opts.Preview.command) > 0 || hasPreviewAction(opts) || opts.ListenAddr != nil {636 // We need to start the previewer even when --preview option is not specified637 // * if HTTP server is enabled638 // * if 'preview' or 'change-preview' action is bound to a key639 // * if 'transform' action is bound to a key640 if len(opts.Preview.command) > 0 || mayTriggerPreview(opts) {641 previewBox = util.NewEventBox()642 }643 var renderer tui.Renderer644 fullscreen := !opts.Height.auto && (opts.Height.size == 0 || opts.Height.percent && opts.Height.size == 100)
3514 unmodified lines