Add change-border-label and change-preview-label actions, update man

This commit is contained in:
jpcrs 2023-01-17 18:43:02 +00:00 committed by Junegunn Choi
parent b077f6821d
commit c3d73e7ecb
3 changed files with 15 additions and 1 deletions

View File

@ -985,7 +985,9 @@ A key or an event can be bound to one or more of the following actions.
\fBcancel\fR (clear query string if not empty, abort fzf otherwise)
\fBchange-preview(...)\fR (change \fB--preview\fR option)
\fBchange-preview-window(...)\fR (change \fB--preview-window\fR option; rotate through the multiple option sets separated by '|')
\fBchange-preview-label(...)\fR (change \fB--preview-label\fR to the given string)
\fBchange-prompt(...)\fR (change prompt to the given string)
\fBchange-border-label(...)\fR (change \fB--border-label\fR to the given string)
\fBchange-query(...)\fR (change query string to the given string)
\fBclear-screen\fR \fIctrl-l\fR
\fBclear-selection\fR (clear multi-selection)

View File

@ -912,7 +912,7 @@ const (
func init() {
executeRegexp = regexp.MustCompile(
`(?si)[:+](execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|transform)-(?:query|prompt)|change-preview-window|change-preview|(?:re|un)bind|pos|put)`)
`(?si)[:+](execute(?:-multi|-silent)?|reload(?:-sync)?|preview|(?:change|transform)-(?:query|prompt)|change-preview-window|change-preview-label|change-border-label|change-preview|(?:re|un)bind|pos|put)`)
splitRegexp = regexp.MustCompile("[,:]+")
actionNameRegexp = regexp.MustCompile("(?i)^[a-z-]+")
}
@ -1224,8 +1224,12 @@ func isExecuteAction(str string) actionType {
return actChangePreviewWindow
case "change-preview":
return actChangePreview
case "change-preview-label":
return actChangePreviewLabel
case "change-prompt":
return actChangePrompt
case "change-border-label":
return actChangeBorderLabel
case "change-query":
return actChangeQuery
case "pos":

View File

@ -306,6 +306,8 @@ const (
actBackwardDeleteCharEOF
actBackwardWord
actCancel
actChangeBorderLabel
actChangePreviewLabel
actChangePrompt
actChangeQuery
actClearScreen
@ -2909,6 +2911,12 @@ func (t *Terminal) Loop() {
case actChangeQuery:
t.input = []rune(a.a)
t.cx = len(t.input)
case actChangeBorderLabel:
t.borderLabel, t.borderLabelLen = t.ansiLabelPrinter(a.a, &tui.ColBorderLabel, false)
req(reqFullRedraw)
case actChangePreviewLabel:
t.previewLabel, t.previewLabelLen = t.ansiLabelPrinter(a.a, &tui.ColPreviewLabel, false)
req(reqFullRedraw)
case actChangePrompt:
t.prompt, t.promptLen = t.parsePrompt(a.a)
req(reqPrompt)