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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30460 invoked from network); 17 Aug 2022 22:31:39 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 17 Aug 2022 22:31:39 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1660775499; b=cHSW1U9GXSRkD57NNqH+iyYt3IPzSbJM9fyS7DwPGEyAEywl3kmBR3n3bmkwOnSxJfcLxHj4Fo 21siXORh43VrusZ3oJmMYsdriWRtCCra5Vr0fCd8SiRLqdT1BS+EHcslGqJrV7v7zjDAevm2Uu hDKuULkr5ii/OyWtWrfroAiRqX6Kjs5423nY8lCiAEXJaAR70kwHCZncwxAP7WVixG5Q4ikS/p MlNtL7u6adCU9Cg3/KKYWnLXDQ0Rswr4Q2y3VaB/l75f1uwo72UE2S518lWskCSpFkFFvXa0z8 vJocKLhRw4UlzE0Wn+v+QHLqaf35NdlhOx3y849VQ5lSbw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f48.google.com) smtp.remote-ip=209.85.208.48; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1660775499; bh=/RNCoYSg317CHbPZOx03o4sx1HxKCfS9gqT13rzaGyk=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Vr4MgMB95wz3yPtnY7Dv/jCF9nX3L0ByMnoxl5M2JzUnE6eMaZ84hYEbJ0DH5R5SWTOwjnlDDM tzjtyO0n7Il9qj6XWxcjG5W7RgLiIm2Ah3nRmIb1VkL7Nl3b4fsq7meNw0MuUiBXED0iMlhXXp iCEPqXyEcZ4hwYyKaLA5p6KdG5NXdSJVuATQ/dEx6zk8AQIb8OGyZRw4QC9Pmxljn3k9pzSrmo 89mQFO/Xy7HvojoF4GKdADaCSpWMneBZKMGm9Z1q4jQMnOyfnV7gNTouwahbyEaFhn3VNlkdh1 qq0iOLamcGIII+YY02ifRc+9wCmVzJWK33X3JSv0oPe6ug==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=U471Hn5U9GTd2gz7z8H51TTzvB+bvIzmCVuyDkcb2QQ=; b=gDb7kOB+ZWv9ChwXEAxvxnJyEi BEI66X/BMJWXMtdLqDYyHNhy6PGcJ63C1fh6J+3i8aqDOAGB8+r3T6EM12YpFkDx54AL+Jwz+C5wt BWg3fKNjJxH5YjzWSWCvE4lpReXmBmk3/F4UNbMOz3MnAOdINOXuTpGoxBf4cznx7HYe6MYWqDDZS tQ5cIGp6TUVCFfdj+WCv44H2eTzfdX09wp8tUuA1mUbe+p43dxWzMfvCGjs73o6JpDebb87vt4mU/ 93VodW1TkknqytCZJ0HY4emuUrg7Bf6Vquc/mztgBxpChboOug+e9z21zjNLYlciIjVixl9NAFLBt s4Jlf8fQ==; Received: from authenticated user by zero.zsh.org with local id 1oORZa-000BBZ-Up; Wed, 17 Aug 2022 22:31:38 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f48.google.com) smtp.remote-ip=209.85.208.48; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ed1-f48.google.com ([209.85.208.48]:34425) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1oORZF-000Aqj-Ao; Wed, 17 Aug 2022 22:31:18 +0000 Received: by mail-ed1-f48.google.com with SMTP id z2so19302023edc.1 for ; Wed, 17 Aug 2022 15:31:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=U471Hn5U9GTd2gz7z8H51TTzvB+bvIzmCVuyDkcb2QQ=; b=8QGt4RvZVYAYH5GFLzAgqShzDqG9648elo5O4XuRYm4/qtwKQiCAkbfbWxJg8nwCKp A11hU3yGs48cNRj7GBfQEiQZAZNON1+jTn4QL0lwMXKhMtDtGhw9XGhu0+A4XHY1fi9S zNILuNTXF24STsXof74MjqZ4cqtxd67+yJWZ7nc86hKrYURrYksLNP8vkY0Upq7Q8SP0 KW8oiaUeVOaomh+lgiMPBTriNrGFL6AN8zwnNBoqNkaL1P1DhbCJoYrKfcaICHr9UcGm hQvb4IsWLaMYwJr0VBbSifV69hZV86zteuUfqrpiKs4+rr7h62lYzsM4V0FZomKm8YNK 0TKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=U471Hn5U9GTd2gz7z8H51TTzvB+bvIzmCVuyDkcb2QQ=; b=ytY2ODsGBLXnrlmIg2cf3wZZNE1wY4aUAqmeQ07e/M0qrTQqG3OVCnE7aSPrVi7rSZ 6lWZSrRWBISH9QN1x4TaC2p87ZJmCVbOeWkGjegho7hYPHkyevfRz6+Xp8II6CwqFGkO c9cZ3oMhLQPZ3Jgic6v542wkbBDXnVhxCZOKV7oVKsnSyadZhdRGyztO93cKdn4VPSNt hhEkJf7aHrPeu8F3JMCCSsPYFdG8wvY6Y6zGB8S25AVY1j766QSgLKDYGWIFpRLfzsCw Kvi+m8QJnOA0zPHzIFScp7hiBkKWuSwa9PuBvXNLCbMpZasi6e2HLbQOG58U83xcn10T LTqQ== X-Gm-Message-State: ACgBeo3udUrSCJw/JQFg9pRI08J64SfrTQYEK3ZueG4LKOTNnh/oMkhM 3+n/EraHerKGLKpIu62o8WzEOaex7R1Ictlt7JQ4vA== X-Google-Smtp-Source: AA6agR6p785eeNsen0DUP6DDv1upnPhG/fFNZWNFNwP1OVgJI1Co4Nk5qxrq+xOamVssyKBtJ+VSr/DHlWCQJ/jFmIM= X-Received: by 2002:a05:6402:4301:b0:43e:4d31:6ec0 with SMTP id m1-20020a056402430100b0043e4d316ec0mr156582edc.69.1660775476956; Wed, 17 Aug 2022 15:31:16 -0700 (PDT) MIME-Version: 1.0 References: <20220811230901.471640-1-felipe.contreras@gmail.com> In-Reply-To: From: Bart Schaefer Date: Wed, 17 Aug 2022 15:31:05 -0700 Message-ID: Subject: Re: [PATCH v2] prompt: support generic non-visible regions To: Felipe Contreras Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 50482 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 Mon, Aug 15, 2022 at 2:37 PM Felipe Contreras wrote: > > Do we want something like "\001foo\002%\001bar%\002"? More on this below. > On Sun, Aug 14, 2022 at 8:00 PM Bart Schaefer wrote: > > > > On Sun, Aug 14, 2022 at 3:47 PM Felipe Contreras > > wrote: > > > > > > That would defeat the primary purpose of the patch, which is to be > > > able to write prompt helper functions which work in multiple shells. > > > > In that case I think the patch is incomplete, because it's not keeping > > track of bv->dontcount and will be confused if both \001 and %} are > > used (or %{ and \002). See lines 602 through 628 of Src/prompt.c > > (line numbers as of commit c5a891a2). > > Yes, I've seen that code, but in my view mixing \001 and %{ doesn't > seem to be a useful use case. Your point above about writing helper functions would seem to imply that someone might inadvertently use such a helper (e.g. via PROMPT_SUBST) inside a section that was already surrounded by %{ %} (or surrounded by \001 \002 though that does seem less likely). The purpose of bv->dontcount (or at least one purpose thereof) is to permit nesting zero-width sections. I agree it wouldn't make sense to (for example) begin a section with %{ and intentionally end it with \002. > I can add code to make %{ and \001 be equivalent, if that's what we > want to do, Ideally they'd in fact be distinct (so it would be some kind of an error to have %{...\002 without an intervening \001 and so on) but that might require a lot more fiddling. > but how am I supposed to do a reasonable test? There isn't a Test/ case for it yet even now. How are we handling %} when there's no %{ before it? I think the answer is that we don't have a test for that either ...