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, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26866 invoked from network); 22 Aug 2022 00:15:53 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 22 Aug 2022 00:15:53 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1661127353; b=Xuzw2dtijJ1WoiEQlTGs+J2Wk1OQtvYOXTjAVi6fBJJyZjdOegy6Apgj8rNKCJhMNSVET1HulU xvcuPKw3jDInqr0xjVt3cpviLDAvf2+ua7mrE7GglLoeu+DiBNP6hYZBd5NtKGfnppD4OHjaDZ pu8WOJnHLy6iYRmxTmyhtW8YSY0oWIfN6axC/w6Zxe63odE4+4C0fonZNTQcQupvg/3/EbdlJ7 8JdLC/gufVP1QfvhaJXPL7XnQzJwIj8ndrnq0XiAN4/T476XeEbub+++jh+CnE46vymNF4F8aW tmMbDKGHyyxaZqoopogkeLXx2Pq3kw85Q2NS60BdzGiNEQ==; 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=gmail.com header.s=20210112 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-20210803; t=1661127353; bh=y72+vYX+ipJuyFqFzAdhtACvTyXDwEBwzgA/T+pLl5g=; 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=beVsW2oMcKhhof9WFohE5ocA9qpOORIcf78DWgyMartb7pPz9Afq12onuOcm31Iqexs+bQ+uLR KrSPudpaoo81N59wUPwTBBkNNGmb7tIGceDBL7NSRmHdmveO+8cBGI+haFxjdj4V+eOG+LH2MO Xj6bwGOlaG42QDe1TrYvV907N9bC/1i7bJ6Y4YiejPDvOLtVrD6yKLOqaLzU7Q6l6ifIKFwOFT msJZ/d8U8DySeoKiGFM9ZG3uONS26xuFLam8l/X1wRM/UhlD7KUTlZCGAKjsMitbF6+R3oFNUq q6qImKS86hU1LzCGU0I24sorSNC9/169YGMlzPS1zQ5mrg==; 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=uHfaqgYh9BL71EDVZFZdZ3qNQ3mhvjculHeoLfCKYCU=; b=OoqZt9RyKF2AT2gqSwkQ3Byck4 8tXmb45zLXMQfPE4rPnoUxPhxJp4EYtz9jJNnfdBtaE5PZqwzrRKFNUnHll3NoAxmgPnFzGo9ix+B RunXgusfVVJP0TqsZUUayzxaz58Ai2+Rhq04vduX5B1ANCOxBAsQ+9TozWz685wmNuhS4vGtgGfDk sXwRC2X5m+jP+N/v9D5fbudhcFR9ViU+ojBH7n/vgm3Nxp19IBEQP5s9qTrWdfdBcUJylznzH+3Ap +cR9LzrI5UqKRO+1DC7/Z41U0a2xwSowZTSqzvQ10znVBwBzVZqd/8z6DAnYjhA28XWYsCoSJEszY SLdv7mZw==; Received: from authenticated user by zero.zsh.org with local id 1oPv6f-000Gfm-DZ; Mon, 22 Aug 2022 00:15:53 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f48.google.com) smtp.remote-ip=209.85.208.48; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ed1-f48.google.com ([209.85.208.48]:33679) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1oPv6J-000GKq-49; Mon, 22 Aug 2022 00:15:31 +0000 Received: by mail-ed1-f48.google.com with SMTP id c39so11894492edf.0 for ; Sun, 21 Aug 2022 17:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=uHfaqgYh9BL71EDVZFZdZ3qNQ3mhvjculHeoLfCKYCU=; b=JOaNuFExYK41iHcoPlg6AvkPvX8kGU/PghXRTlAmUcQdwauYOFEbvcz093su21bHQV 6IGCu2/I2q3OJmww4aGV+M/Wu/tcX8U2W3G1P8QvRSkjkmnMACW8E8O4ZwOSjPYROpuM W81kNhAy/B5nznMrJ3AR56VzskvjO+Se94+fq4UzG+FL4MiLsOkD8WGG7Ii4Q0Jez8Nj xF+IOl+G9ctPDIfMnA4znepwvsKUwiJvSYHCnrknlU83kAIeACkUZxVinErRFzenuGV2 cSL1kMdPXLQdXfnwmczLlDNVNdzBQsWSDl/E/A+K+30zhIVHOVK+t5JvzPYyr4OESfmS bqTg== 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=uHfaqgYh9BL71EDVZFZdZ3qNQ3mhvjculHeoLfCKYCU=; b=vRg+CaFWcEPk8AZnBf/EXs2Yx6HBhtckUuKTlZwrR+griyEvhIv4x3jo/+oLJcVNFj cjLPq6u5gjsI4JIaAZhWQnmgMUWpdEUq/IMTl+poDh1V/NdERzsIz7BURephdH45xIx3 u8GrKgxQWm1sI07saomev2KWfgNwuLcKxMV+g05nX0qdeiz/ppc7jLvm/uSI4sD5/GSO ZdHhkiqkOjdeGJbmQJ+FEKxJZaw7xy2HCm4joolXtc69KN/imV/BgwK4iiA9l/x3+4On wQZdz39ccVELi3UGIqpK/ke7k8mP1JsC+0J4FDN/i9R1lsfSkKZWJISmwKrFLEpUhmk8 7sFg== X-Gm-Message-State: ACgBeo0clxIQpVAiziyRDqQDdeliKKFJKrq34+IEObOqjdCBUgkHU6JV em76QPCZcxrtETYLe7kOBVVz+5+X9SJDXgSA5YbqDcH2WHo= X-Google-Smtp-Source: AA6agR4/HDwU0CtNEYma9DTg4/3Wm16x7Ers+PsJjP45hUvLANSuQenONGig6ixs+yZbG19VTa2PrYksiYfEka3RHvY= X-Received: by 2002:a05:6402:4304:b0:446:8feb:3bd with SMTP id m4-20020a056402430400b004468feb03bdmr5225187edc.69.1661127330513; Sun, 21 Aug 2022 17:15:30 -0700 (PDT) MIME-Version: 1.0 References: <20220811230901.471640-1-felipe.contreras@gmail.com> In-Reply-To: From: Felipe Contreras Date: Sun, 21 Aug 2022 19:15:19 -0500 Message-ID: Subject: Re: [PATCH v2] prompt: support generic non-visible regions To: Bart Schaefer Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 50492 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 Wed, Aug 17, 2022 at 5:31 PM Bart Schaefer wrote: > > 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. Yeah, I guess that's possible, although I don't think very likely. > > 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 ... I didn't mean a proper test case, I meant just to check that the code actually works. Anyway, this is how I decided to test it: $' %{\e[31m\x01\e[31m\x01\e[31m\x02\e[31m\x02\e[31m%}master%{\e[m\x01\e[m\x01\e[m\x02\e[m\x02\e[m%}' I've sent patch v3 and seems to work fine with all this nesting. -- Felipe Contreras