Hi,

I noticed that if you are using `compinit`, diff(1) completions don't work
right.

E.g. if you do `diff -u /etc/doas.conf /etc/exa<tab>` (expecting it to complete
to `/etc/examples`), it won't complete.

Mentioned this on their IRC channel and someone there by the name Mikachu
pointed me to:
https://sourceforge.net/p/zsh/code/ci/996b51515600859ce7f952f22c6262ecd24578e1/

The below diff applies that patch, thus fixing diff completions.

Thanks to Mikachu!

OK to commit?

Index: Makefile
===================================================================
RCS file: /cvs/ports/shells/zsh/Makefile,v
diff -u -p -r1.97 Makefile
--- Makefile    27 Sep 2023 16:41:31 -0000      1.97
+++ Makefile    30 Dec 2023 13:20:31 -0000
@@ -1,6 +1,7 @@
 COMMENT=       Z shell, Bourne shell-compatible
 
 V=             5.9
+REVISION=      0
 DISTNAME=      zsh-$V
 CATEGORIES=    shells
 
Index: patches/patch-Completion_Unix_Type__diff_options
===================================================================
RCS file: patches/patch-Completion_Unix_Type__diff_options
diff -N patches/patch-Completion_Unix_Type__diff_options
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-Completion_Unix_Type__diff_options    30 Dec 2023 13:26:53 
-0000
@@ -0,0 +1,75 @@
+Fix diff(1) completions for OpenBSD.
+
+https://sourceforge.net/p/zsh/code/ci/996b51515600859ce7f952f22c6262ecd24578e1/
+
+Index: Completion/Unix/Type/_diff_options
+--- Completion/Unix/Type/_diff_options.orig
++++ Completion/Unix/Type/_diff_options
+@@ -133,33 +133,44 @@ else
+   case $OSTYPE in
+     openbsd*|solaris2.<9->)
+       of+=' -u -U'
++    ;|
++    openbsd*|solaris*)
++      of+=' -n -C -D'
++    ;|
++    solaris*)
++      of+=' -h'
++    ;|
++    openbsd*)
++      of+=' -q'
++    ;|
++    # modifications to "$of" should be done above this line so that it is
++    # uniformly defined while constructing $args
++    openbsd*|solaris2.<9->)
+       args+=(
+-      "($of)-u[output a unified diff]"
+-      "($of)-U+[output a unified diff]:lines of context"
++        "($of)-u[output a unified diff]"
++        "($of)-U+[output a unified diff]:lines of context"
+       )
+     ;|
+     openbsd*|solaris*)
+       args+=(
+-      "($of)-C+[output a context diff]:lines of context"
+-      "($of)-D+[output merged file with preprocessor directives]:preprocessor 
symbol"
+-      '-i[case insensitive]'
+-      '-l[long output format (paginate with pr(1))]'
+-      '-s[report on identical files]'
+-      '-t[expand tabs in output lines]'
++        "($of)-C+[output a context diff]:lines of context"
++        "($of)-D+[output merged file with preprocessor 
directives]:preprocessor symbol"
++        '-i[case insensitive]'
++        '-s[report on identical files]'
++        '-t[expand tabs in output lines]'
+       )
+     ;|
+     solaris*)
+-      of+=' -h -n'
+       args+=(
+-      '-w[ignore all white space]'
+-      "($of)-h[do a fast, half-hearted job]"
+-      "($of)-n[output a reversed ed script]"
++        '-w[ignore all white space]'
++        "($of)-h[do a fast, half-hearted job]"
++        "($of)-n[output a reversed ed script]"
+         '-S+[set first file in comparison]:start with file:_files'
++        '-l[long output format (paginate with pr(1))]'
+       )
+     ;;
+     openbsd*)
+-      of+=' -n -q -u -C -D -U'
+-      args=(
++      args+=(
+         "($of)-n[output an rcsdiff(1)-compatible diff]"
+         "($of)-q[only print a line when the files differ; does not produce a 
list of changes]"
+         '-a[treat all files as ASCII text]'
+@@ -173,7 +184,7 @@ else
+         '-P[treat absent files in the second directory as if they were empty]'
+         '-S[start a directory diff from a file name]:file name:_files'
+         '*-X[exclude files and subdirectories whose basenames match lines in 
a file]:file name:_files'
+-        '-x[exclude files and subdirectories whose basenames match a 
pattern]:pattern'
++        '*-x[exclude files and subdirectories whose basenames match a 
pattern]:pattern'
+       )
+     ;;
+   esac

-- 
Best Regards
Edd Barrett

https://www.theunixzoo.co.uk

Reply via email to