summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpcrs <joaop.carrasco@gmail.com>2023-01-17 18:43:02 +0000
committerJunegunn Choi <junegunn.c@gmail.com>2023-01-22 02:18:19 +0900
commitc3d73e7ecbe56358949400f5314fee2d6976885a (patch)
treec233c4fa96c626f27f43caf64933be5dade83921
parentb077f6821d4f27ac9e4f1acd4619139ba4a14d14 (diff)
Add change-border-label and change-preview-label actions, update man
-rw-r--r--man/man1/fzf.12
-rw-r--r--src/options.go6
-rw-r--r--src/terminal.go8
3 files changed, 15 insertions, 1 deletions
diff --git a/man/man1/fzf.1 b/man/man1/fzf.1
index 846a5bd0..832524f5 100644
--- a/man/man1/fzf.1
+++ b/man/man1/fzf.1
@@ -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)
diff --git a/src/options.go b/src/options.go
index 39b1b0e1..f22e767a 100644
--- a/src/options.go
+++ b/src/options.go
@@ -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":
diff --git a/src/terminal.go b/src/terminal.go
index b21aca73..5b03f6d7 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -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)