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,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14800 invoked from network); 24 Oct 2020 14:21:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 24 Oct 2020 14:21:33 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1603549293; b=lxkCOsR1Oaf93PJe6RSQARYpAWF6tYgS0Iz2bERUOi7wlb7zK7Uil4kfg6gxqvJ2KQxnUw7wJB 9BJiOgJAI7e7OKdyhEKAKI6ttPGszlX2KBJxu9sl7a0f8/O7XmPTNVuPbR9gpuN/DISy12vLVg QrkJaGBUImeIfIgxtEO+4uWMRpPoNX9YQ4MXK2oCM4bt5JR32RSesG20LopJ6v7lImpDLXKQTK PplRzYr2WQjvMFpVMXx8x8C99wnZLeofYuSijscsUzjB3IqLf54U8VZjyNcSO01R6AFyhHVyOy VioUVGpu11v1yv1I3goAVqx5qcYCbU8ld8bSOWkz43r/Jw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-io1-f50.google.com) smtp.remote-ip=209.85.166.50; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1603549293; bh=fkS0NcEpM5p/DlJW7PZKZYmZvJjpRteyqsTQ5ZeeULg=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=Q/iNCyg76oTi1smp0gMR5cW8gQDDnaEyuNThvM7iOWO/x1bezf2fBn1P7zpCGzw8JgfM7IJE1X kBNotudhlE9W4xb1CKK9Davny1vEulCkNaIiDVlFX4mJk4N85zz9zxCv1Q8WpOySaR4EMoVLQK A51XtgLL7ItMSgjJQOySP4zEVJ7eI76CvWMCKYdWJSJ6ncNbnYEVFDCksJUmIPPutGC+x/KYjU /hIt4a0IaQZkNdpS39FOCxgX3zvNDmUWHVAnBDf+NMxAdCMMl8K/JSpA19mBOwXboKWJlhJJQr Q8RlYmjmMiEC9yh6dM8ZMTOE1FU+xGU5wWXRpvB5p4+9lQ==; 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:Content-Type:To:Subject:Message-ID: Date:From:References:In-Reply-To:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=CYvO2UCBVR2FzN0dP7+8u37qMQOEsByr5WCTmSIV9gg=; b=nrPmY7uX2GgryCrOgwEcFbujjG wZLBDQljMzK0KnGVqNnaEJvMjkczWHMJIDLLikyPZE+Fh/Gk6kdL8DGfl4R3lGA4yUUCA7bm03Xwp IZN1fWQ9tdQHSS/KcBcSk6RHmFAzBMZeNbQ05SHGf70RMTDjbVJX57SnyWHurPhWm7hitplLnkWMw a+p/FiGzNBj+bn92xUT87mU5r2YT0g6lhV+2QZqJZSZgzWbR9EMuQIYojuC6IL5V3oETfS+oRrA10 o5/k6aZ8JTCB1bP5Hwt5MkfMjhmppHlLTt26WxEydr5f/1TyAsdQI3Dt3dkvy6Dm5zvjddeJQhYO0 5cQhfaEA==; Received: from authenticated user by zero.zsh.org with local id 1kWKQH-000GsP-3j; Sat, 24 Oct 2020 14:21:33 +0000 Authentication-Results: zsh.org; iprev=pass (mail-io1-f50.google.com) smtp.remote-ip=209.85.166.50; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-io1-f50.google.com ([209.85.166.50]:41937) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kWKPw-000Gip-3Y; Sat, 24 Oct 2020 14:21:13 +0000 Received: by mail-io1-f50.google.com with SMTP id u62so5417210iod.8 for ; Sat, 24 Oct 2020 07:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=CYvO2UCBVR2FzN0dP7+8u37qMQOEsByr5WCTmSIV9gg=; b=Jbj/yHGKMr23ksELGPk3m5MZq+KZuBpoFxB8g+r4jN78AZeg+u8a1vRSCh96P6yPJh qgEx6qoBwC4wK6ROZw6x+cQafhJVLVQ2fvPxNhEvIj0ttt2N7ZUtCybrO3MWgLmb4z4/ fbElHcr2pTyoDPJ0hIttAMg2u8wPNYmG4z0M5N9uhrHoy3Y7bi/NZt4S9/o+IzdnnzuL Urxi/Z8JyVUJn861fuqeWzDlXr2NRvuEvpGNood2yIuGYyRFerybwFknx4/j0+Q1FNeT 6zhI6rzXicqz9cwtIkiX83YvkzaYwYHh3B5gbTUcNBi7aHoDc0blRAo+zwdBsUTmQUVR g/ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=CYvO2UCBVR2FzN0dP7+8u37qMQOEsByr5WCTmSIV9gg=; b=L6XmS33WCg9e2vlGxRX0MCtPNnqMef1v0uBICgK/wRXOfTGVX24KdRtipN1fLvVTOp 4md4Xg5Y8OJVw6L0k7Xx2lxRnZkZEDL/y/UYhEHcjrDhtgSpFtrib/p1dhElV58MBDyE r6Wdbf6Iy0Oy/TjgKCXSoIC8MfpVrmhvXLFoEqX5zNR1rxQcbS45Ad9V+kYW5IxZ1MAn Y/HyhuxBOfcOY6kON9xDBX2Y6ynrvaneqJJvB/J0dPwRYkbTZEf2qsCt5ZoFantpL5x0 UMEPSiOJeqsKhtJdKKPGfB4zFjdJF9ao16XdrnWxkIBKk3jDktukgbzK7HtIsY/VCDBK 9xzQ== X-Gm-Message-State: AOAM532r/arQDOCT6sPq7+JRhQg3q7b5631t3vPkpPCw0rDsRyjqhzWG vW8j6P5q9Nn26z1HOkkUet3xUD8E8V+QghsRFxl+DTwk X-Google-Smtp-Source: ABdhPJxd2cNqZZ4qADViW+ooHyEsEC5Y5y+LStBGXl3s46N8SRNaeQQP6e4Mimo1FEKwvYv+L5ZCbc3oz/gMH89HeRY= X-Received: by 2002:a5d:8853:: with SMTP id t19mr5097064ios.164.1603549270387; Sat, 24 Oct 2020 07:21:10 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:1b03:0:0:0:0:0 with HTTP; Sat, 24 Oct 2020 07:21:09 -0700 (PDT) In-Reply-To: <20200830111346.xulnbxoqxduetnoz@chazelas.org> References: <20200830111346.xulnbxoqxduetnoz@chazelas.org> From: Mikael Magnusson Date: Sat, 24 Oct 2020 16:21:09 +0200 Message-ID: Subject: Re: [regression] %2K prompt expansion no longer works To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 47496 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: Archived-At: On 8/30/20, Stephane Chazelas wrote: > $ print -rnP %2K | hd > 00000000 1b 5b 34 30 6d |.[40m| > 00000005 > > %K{2} is fine: > > $ print -rnP '%K{2}' | hd > 00000000 1b 5b 34 32 6d |.[42m| > 00000005 > > Introduced by worker:30496 > (https://www.zsh.org/mla/workers/2012/msg00421.html > 8a9b141652a0e4157056dc21e36a64ac712a7ee7 git commit). > > Oddly, the comment there: > >> Well, nobody objected so here's a version with de-duplicated >> code. The previous patch broke %K, but it works now (passed 1 >> for is_fg on both paths). > > Actually describes the bug here. Looks like Mikael just missed a bit in > that > fix. > > Should be fixed with: > > > diff --git a/Src/prompt.c b/Src/prompt.c > index bc9734720..997327e18 100644 > --- a/Src/prompt.c > +++ b/Src/prompt.c > @@ -258,7 +258,7 @@ parsecolorchar(zattr arg, int is_fg) > bv->fm--; > } > } else > - arg = match_colour(NULL, 1, arg); > + arg = match_colour(NULL, is_fg, arg); > return arg; > } Just noticed that these [unposted] testcases don't pass. Added some debugging prints and it turns out that %F{green} uses a different code than specifying the number. Eg, echo $F1 $F2 $F3 $F4 | cat -v results in ^[[38;5;2m ^[[38;5;2m ^[[38;5;2m ^[[32m (the results are equivalent if you explicitly set fg_start_code to ^[[38;5;, but the test case doesn't do that, and of course that might not be what terminfo contains anyway.) I think the correct fix is to not include F4 and K4 since they use these definitions in the source code: #define TC_COL_FG_START "\033[3" #define TC_COL_BG_START "\033[4" which will not match the others. -- Mikael Magnusson