From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id f7ce1b49 for ; Mon, 6 May 2019 23:12:27 +0000 (UTC) Received: (qmail 3326 invoked by alias); 6 May 2019 23:12:13 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44275 Received: (qmail 2118 invoked by uid 1010); 6 May 2019 23:12:13 -0000 X-Qmail-Scanner-Diagnostics: from mail-it1-f171.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25440. spamassassin: 3.4.2. Clear:RC:0(209.85.166.171):SA:0(-1.9/5.0):. Processed in 1.811439 secs); 06 May 2019 23:12:13 -0000 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=oXRJQ3OBBnQYNXxOaFMNfBsALysON+n5B+GFdYaO6JU=; b=aFFtZza2CKRne4xtz5XYLwtW4WrGtcnrxeG7eK/ddxmutCIUJv/gN9s7/c6LRsurzS omU2xP4U0Ai/ANTgVSCHlKe0AInN930/uA0KDBduGTK6osHuwCYTIreISH7O8GP1cxJr jTNE/XsOuKF8gZ3vrvPRjDvNRviv75zGJxGorPR7DG3gW6FYR6PClwmwhR3rj3ivjbIW 4LQMvDrQAfoaHPJNxG7S11Y7OwnQIKKDJB015K5pAe/JsguUk3B5ZRR3zhpnIMDew+56 mn8Dgj9I3BIPIBcEVpTSs6Uo17norvUxFd+mLD556BJeDvkry7/lLEh2ob7vR8MAtbnr K4Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=oXRJQ3OBBnQYNXxOaFMNfBsALysON+n5B+GFdYaO6JU=; b=ESezTMwbW6rY4AV0iub1xCpialZ6oFFRPRAGBPqYIqDgJDJrty7uGD1nsvFMB4ai9g JpgQ6WCXJu6ArL6ziYV+2Aj0B8JLrEZog2zjxyHHa6ULDzSP/AaDiv5i1OMrTGVXc7BN 6V4PMU7bhr5Pdh+bSvaa3tsUzqBM4fL4Jpq+22BMCtiHGrn0vDQgSVY0CmT7K778Xdm/ 6f4HRu3vmdnDqU6OR1aC+JmCurWCJiyxBoQw0I23T+jH0PgMQTqZj+2EratAvWP7K5FU Fh3ikckQAWqW+8ac5x/N22TEfetKxwVSO5M3d1vy4Lg3u1wl6MGUEStc8tsHXEof/aBK fP2w== X-Gm-Message-State: APjAAAWDDOvurwUcrwSVQMnyloYqqQTOO/IzaVul62QgYMsK32bbbAlt t7p1ivucgxOJDYSy/hOd0vGB7moyx55ygw== X-Google-Smtp-Source: APXvYqzBOR6D7Wh0mg8h1u3qhjwZtKGozgfdiFGHCN63v1mRsoCSS7G3VjohHAGEZ/i/sc8CovoekQ== X-Received: by 2002:a24:6b92:: with SMTP id v140mr21193317itc.161.1557184298632; Mon, 06 May 2019 16:11:38 -0700 (PDT) From: dana Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: [PATCH/RFC] Fix compset -p/-s inconsistency and documentation Message-Id: Date: Mon, 6 May 2019 18:11:37 -0500 To: Zsh hackers list X-Mailer: Apple Mail (2.3445.9.1) Whilst investigating workers/44272, a failure of the Y01 _tilde test led = me to discover that compset -p/-s doesn't work consistently with and without multi-byte support: % _foo() { compset -p 1; _message "${(qq)IPREFIX} ${(qq)PREFIX}" } % compdef _foo foo # Without multi-byte % _comp_options+=3D( no_multibyte ) % foo . completing '' '.': # With multi-byte % _comp_options+=3D( multibyte ) % foo . completing '.' '': I think this is the result of workers/41835. Restoring the original behaviour seems simple (see patch), but i wanted = to confirm that it's the right thing, because the original behaviour = actually didn't (and the current behaviour still doesn't) match the = documentation: > If the contents of the PREFIX parameter *is longer than* number = characters, > the first number characters are removed from it and appended to the = contents > of the IPREFIX parameter. Am i right to conclude that the documentation is wrong? dana diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo index 1cc94bf95..0f13b7fe0 100644 --- a/Doc/Zsh/compwid.yo +++ b/Doc/Zsh/compwid.yo @@ -728,8 +728,8 @@ The options are: =20 startitem() item(tt(-p) var(number))( -If the contents of the tt(PREFIX) parameter is longer than var(number) -characters, the first var(number) characters are removed from it and +If the value of the tt(PREFIX) parameter is at least var(number) +characters long, the first var(number) characters are removed from it = and appended to the contents of the tt(IPREFIX) parameter. ) item(tt(-P) [ var(number) ] var(pattern))( diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c index 1dc2b01c2..0f3721b05 100644 --- a/Src/Zle/complete.c +++ b/Src/Zle/complete.c @@ -962,7 +962,7 @@ do_comp_vars(int test, int na, char *sa, int nb, = char *sb, int mod) } } else #endif - if ((int)strlen(test =3D=3D CVT_PRENUM ? compprefix : = compsuffix) >=3D na) + if ((int)strlen(test =3D=3D CVT_PRENUM ? compprefix : = compsuffix) < na) return 0; if (test =3D=3D CVT_PRENUM) ignore_prefix(na);