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

pull/3160/head
jpcrs 1 year ago committed by Junegunn Choi
parent b077f6821d
commit c3d73e7ecb

@ -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) \fBcancel\fR (clear query string if not empty, abort fzf otherwise)
\fBchange-preview(...)\fR (change \fB--preview\fR option) \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-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-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) \fBchange-query(...)\fR (change query string to the given string)
\fBclear-screen\fR \fIctrl-l\fR \fBclear-screen\fR \fIctrl-l\fR
\fBclear-selection\fR (clear multi-selection) \fBclear-selection\fR (clear multi-selection)

@ -912,7 +912,7 @@ const (
func init() { func init() {
executeRegexp = regexp.MustCompile( 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("[,:]+") splitRegexp = regexp.MustCompile("[,:]+")
actionNameRegexp = regexp.MustCompile("(?i)^[a-z-]+") actionNameRegexp = regexp.MustCompile("(?i)^[a-z-]+")
} }
@ -1224,8 +1224,12 @@ func isExecuteAction(str string) actionType {
return actChangePreviewWindow return actChangePreviewWindow
case "change-preview": case "change-preview":
return actChangePreview return actChangePreview
case "change-preview-label":
return actChangePreviewLabel
case "change-prompt": case "change-prompt":
return actChangePrompt return actChangePrompt
case "change-border-label":
return actChangeBorderLabel
case "change-query": case "change-query":
return actChangeQuery return actChangeQuery
case "pos": case "pos":

@ -306,6 +306,8 @@ const (
actBackwardDeleteCharEOF actBackwardDeleteCharEOF
actBackwardWord actBackwardWord
actCancel actCancel
actChangeBorderLabel
actChangePreviewLabel
actChangePrompt actChangePrompt
actChangeQuery actChangeQuery
actClearScreen actClearScreen
@ -2909,6 +2911,12 @@ func (t *Terminal) Loop() {
case actChangeQuery: case actChangeQuery:
t.input = []rune(a.a) t.input = []rune(a.a)
t.cx = len(t.input) 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: case actChangePrompt:
t.prompt, t.promptLen = t.parsePrompt(a.a) t.prompt, t.promptLen = t.parsePrompt(a.a)
req(reqPrompt) req(reqPrompt)

Loading…
Cancel
Save