summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs/override
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-12-05 21:32:08 +0100
committerlassulus <lassulus@lassul.us>2022-12-05 21:32:08 +0100
commit0447cf6a5fd3435a0acb68d077b0380da12f104d (patch)
treebb3644b84ce81b64443efd8e767a121a741bb008 /tv/5pkgs/override
parent5d0d1993b6207c283189a2c81c8c76f549d44b2a (diff)
parent8e32364d6299b5f5816d886653349794aadc1ec9 (diff)
Merge remote-tracking branch 'ni/master' into 22.11
Diffstat (limited to 'tv/5pkgs/override')
-rw-r--r--tv/5pkgs/override/fzf/complete1.patch90
-rw-r--r--tv/5pkgs/override/fzf/default.nix8
2 files changed, 59 insertions, 39 deletions
diff --git a/tv/5pkgs/override/fzf/complete1.patch b/tv/5pkgs/override/fzf/complete1.patch
index 4b2126a2c..3e3f2c4d5 100644
--- a/tv/5pkgs/override/fzf/complete1.patch
+++ b/tv/5pkgs/override/fzf/complete1.patch
@@ -1,50 +1,72 @@
+commit 57cbd76c068121b685399fdb4649e7ba537983d6
+Author: tv <tv@krebsco.de>
+Date: Mon Dec 5 15:24:30 2022 +0100
+
+ Add --complete-1 option
+
+diff --git a/man/man1/fzf.1 b/man/man1/fzf.1
+index 79e7291..3b8a753 100644
+--- a/man/man1/fzf.1
++++ b/man/man1/fzf.1
+@@ -685,6 +685,9 @@ interactive finder and automatically select the only match
+ If there is no match for the initial query (\fB--query\fR), do not start
+ interactive finder and exit immediately
+ .TP
++.B "--complete-1"
++Exit interactive finder when there's exactly one match
++.TP
+ .BI "-f, --filter=" "STR"
+ Filter mode. Do not start interactive finder. When used with \fB--no-sort\fR,
+ fzf becomes a fuzzy-version of grep.
diff --git a/src/core.go b/src/core.go
-index a18c3a1..a3d92a4 100644
+index 2ddddc3..09afff2 100644
--- a/src/core.go
+++ b/src/core.go
-@@ -331,6 +331,13 @@ func Run(opts *Options, version string, revision string) {
+@@ -337,8 +337,14 @@ func Run(opts *Options, version string, revision string) {
+ }
+ determine(val.final)
}
- }
- terminal.UpdateList(val, clearSelection())
-+ if (opts.Complete1) {
-+ count := val.Length()
-+ if count == 1 {
++ } else {
++ if opts.Complete1 && val.Length() == 1 {
+ opts.Printer(val.Get(0).item.AsString(opts.Ansi))
+ terminal.reqBox.Set(reqClose, nil)
++ } else {
++ terminal.UpdateList(val, clearSelection())
+ }
-+ }
+ }
+- terminal.UpdateList(val, clearSelection())
}
}
}
diff --git a/src/options.go b/src/options.go
-index a55dc34..7f121cd 100644
+index 5400311..1e38fe4 100644
--- a/src/options.go
+++ b/src/options.go
-@@ -92,6 +92,7 @@ const usage = `usage: fzf [options]
- -1, --select-1 Automatically select the only match
- -0, --exit-0 Exit immediately when there's no match
- -f, --filter=STR Filter mode. Do not start interactive finder.
-+ --complete-1 Exit interactive finder when there's exactly one match
- --print-query Print query as the first line
- --expect=KEYS Comma-separated list of keys to complete fzf
- --read0 Read input delimited by ASCII NUL characters
-@@ -208,6 +209,7 @@ type Options struct {
- Query string
- Select1 bool
- Exit0 bool
-+ Complete1 bool
- Filter *string
- ToggleSort bool
- Expect map[tui.Event]string
-@@ -269,6 +271,7 @@ func defaultOptions() *Options {
- Query: "",
- Select1: false,
- Exit0: false,
-+ Complete1: false,
- Filter: nil,
- ToggleSort: false,
- Expect: make(map[tui.Event]string),
-@@ -1311,6 +1314,8 @@ func parseOptions(opts *Options, allArgs []string) {
+@@ -108,6 +108,7 @@ const usage = `usage: fzf [options]
+ -1, --select-1 Automatically select the only match
+ -0, --exit-0 Exit immediately when there's no match
+ -f, --filter=STR Filter mode. Do not start interactive finder.
++ --complete-1 Exit interactive finder when there's exactly one match
+ --print-query Print query as the first line
+ --expect=KEYS Comma-separated list of keys to complete fzf
+ --read0 Read input delimited by ASCII NUL characters
+@@ -274,6 +275,7 @@ type Options struct {
+ Query string
+ Select1 bool
+ Exit0 bool
++ Complete1 bool
+ Filter *string
+ ToggleSort bool
+ Expect map[tui.Event]string
+@@ -342,6 +344,7 @@ func defaultOptions() *Options {
+ Query: "",
+ Select1: false,
+ Exit0: false,
++ Complete1: false,
+ Filter: nil,
+ ToggleSort: false,
+ Expect: make(map[tui.Event]string),
+@@ -1546,6 +1549,8 @@ func parseOptions(opts *Options, allArgs []string) {
opts.Exit0 = true
case "+0", "--no-exit-0":
opts.Exit0 = false
diff --git a/tv/5pkgs/override/fzf/default.nix b/tv/5pkgs/override/fzf/default.nix
index 661db0ed5..2254d455a 100644
--- a/tv/5pkgs/override/fzf/default.nix
+++ b/tv/5pkgs/override/fzf/default.nix
@@ -1,9 +1,7 @@
self: super:
super.fzf.overrideAttrs (old: {
- # XXX cannot use `patches` because fzf has a custom patchPhase
- patchPhase = ''
- patch -Np1 < ${./complete1.patch}
- ${old.patchPhase or ""}
- '';
+ patches = old.patches or [] ++ [
+ ./complete1.patch
+ ];
})