zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Arusekk <arek_koz@o2.pl>
Cc: zsh-workers@zsh.org
Subject: Re: [completion] GDB completion bug
Date: Fri, 09 Apr 2021 00:39:48 +0200	[thread overview]
Message-ID: <57309-1617921588.554897@Ghcb.QeMr.M9WN> (raw)
In-Reply-To: <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
 


      parent reply	other threads:[~2021-04-08 22:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-22 22:39 Arusekk
2020-11-23  4:12 ` Daniel Shahaf
2021-04-08 22:39 ` Oliver Kiddle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57309-1617921588.554897@Ghcb.QeMr.M9WN \
    --to=opk@zsh.org \
    --cc=arek_koz@o2.pl \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).