From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 22353 invoked from network); 8 Apr 2021 22:40:20 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 8 Apr 2021 22:40:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:References:From:In-reply-to:cc:Reply-To: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=uRqlWsd5WRVip1VWWDJcuCWLAQNlA9S4nSANLpGqJi4=; b=uowcmOYgcH5SUiguARlitVsxmh WayM8hNglroB0dNw5nB4nHfGQaae7K0uWpFV2KOsJHd6GXBIczAVDu0kVjnQgJH6nbp8bK1OTdurl 7GEKv+ZfVh32eC/PqxHmChYBU6RP4ksz0OpiHoDcXuWoyevrsciaK+bkrNKHQ0Ujc9ukT3GUq9JkI zb/gfg/Y/t+KxEOwKQWb63y2OKRFvdK9JOrz99GD5At17dkx5uFRPcKV5V+1NZntNGOnIZFuGqCFQ TqM70VX0kFMxM78Dwuw9VMWYxMbr6avk9dyZxhuPCFBiyGUoRpAb+8YJHWPP2VlhN4hxLJvgXdHus /tgdgghA==; Received: from authenticated user by zero.zsh.org with local id 1lUdJz-000Hzp-Dh; Thu, 08 Apr 2021 22:40:19 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lUdJV-000HkN-0Q; Thu, 08 Apr 2021 22:39:49 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.93.0.4) (envelope-from ) id 1lUdJU-000EuM-I2; Fri, 09 Apr 2021 00:39:48 +0200 cc: zsh-workers@zsh.org In-reply-to: <3f0884a6-18f8-4d0d-2bae-e9ac3f3636ba@o2.pl> From: Oliver Kiddle References: <3f0884a6-18f8-4d0d-2bae-e9ac3f3636ba@o2.pl> To: Arusekk Subject: Re: [completion] GDB completion bug MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <57308.1617921588.1@hydra> Date: Fri, 09 Apr 2021 00:39:48 +0200 Message-ID: <57309-1617921588.554897@Ghcb.QeMr.M9WN> X-Seq: 48437 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: 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