Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [completion] GDB completion bug
- X-seq: zsh-workers 48437
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Arusekk <arek_koz@xxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: [completion] GDB completion bug
- Date: Fri, 09 Apr 2021 00:39:48 +0200
- Archived-at: <https://zsh.org/workers/48437>
- In-reply-to: <3f0884a6-18f8-4d0d-2bae-e9ac3f3636ba@o2.pl>
- List-id: <zsh-workers.zsh.org>
- References: <3f0884a6-18f8-4d0d-2bae-e9ac3f3636ba@o2.pl>
On 22 Nov, Arusekk wrote:
> The bug is not critical in any way, but just happens in the following
> setting:
>
> zsh-5.8% gdb (cursor here) -h
> _pids:shift:13: shift count must be <= $#
> _pids:compadd:42: bad option: -m
In this case, I think we can fix this by limiting the search of the
$words array to words preceding the cursor as in the following patch.
I've also updated somewhat the pattern for options that might take
an argument in a following word.
In general, gdb completion could be improved quite a bit more.
> Glad to have found a bug in such reliable software!
> Arusekk
Thanks for reporting this and sorry for not dealing with it sooner.
Oliver
diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb
index 18f797633..6bdd55946 100644
--- a/Completion/Unix/Command/_gdb
+++ b/Completion/Unix/Command/_gdb
@@ -40,9 +40,9 @@ else
(-b) _baudrates && return 0 ;;
esac
- w=( "${(@)words[2,-1]}" )
+ w=( "${(@)words[2,CURRENT-1]}" )
while [[ "$w[1]" = -* ]]; do
- [[ "$w[1]" = -[decsxb] ]] && shift 1 w
+ [[ "$w[1]" = -(cd|se|tty|[decsxb]) ]] && shift 1 w
shift 1 w
done
Messages sorted by:
Reverse Date,
Date,
Thread,
Author