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 27826 invoked from network); 15 Aug 2022 21:42:44 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Aug 2022 21:42:44 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1660599764; b=QfeCUomzhZ62UEdy9iuo50uRDpvVc5Z3qWIrTrZlLMAuT+7JBf4T7wLIEfw9tmvklhaiW5Wz+b o6PQfBOsnjGSLdG1w5sBoqR/650LWxgaLWsXiXN/ZMgTmWvXatlxydyctM630KhVdwK27TtJiO paXCl6MFGa89+Mw0fhMVz9F/aHMlWb/O0Re0M6vFXDQt0vVzFXLnIduY5FQzfmy52l1EFIH+cQ neM+yHF/aGO4cKe4Z7P3KF44fyEjQNzV7PUowlAfi6q1aAuLsy0KFxP7uVFNjOKiJ9ujX9o/St 5ZwquL5R6UNsyWbZCCWy6pyByXCzzrlT+b0OHoOfSxUzrQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f49.google.com) smtp.remote-ip=209.85.218.49; 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=1660599764; bh=5JpXyz9PgglguXPFTAgKWj2W8Q3ev484y8Sdh5+yrjY=; 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=lNweGbmf01AV42AJlOII7VhIVpieJKgKI5rgCtexJW4hEjL9PGaK9AA3J2aYQ+ZPjc/1m8vxn6 JusQonFzhl7nlYEwhNO293Uo0JwkErROMaVFDhaFyH0apvbnlw71aR0+X6sE7moME99M+jiBzl mieI8FdcFgk2c17ych7mohCALY+S+RL97wtZJxO8VRVkrQih/6Fi5J8Viyv1nT64QNlu/s/XDf B7Q/OLctyW+BG+PsPkVsSllpzPqOlKNpoxcUtWvMRtPHaZnowsyPt1FgtZbZ4yUpKuDHwVxDDd mgmfz9AJ+YfQTdSKGk3oOxuxAv8KDdUb6SmfEKcYPDS1yw==; 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=Xnd93OQQV+B8eAid0rWeTFUnGaoD9VWldhyrbMxXVzs=; b=h8Z44+O/akjSXaqd/D9rrKWZrc WOR0+6HG/1phgYhO21Q/ifeddRSmG2tV/iHnDFED3aHpx3Sb7NV2jzFFzCG+zD1nBpsw4Mn5UGgAp QoWwIq/48FnTREuj/hRH0/0xj9FZd0qQNWlL6R/GF9TdOs3kFaQFVNuikEWmCkIl5RxTNKh3ftJjG 5g/G0dvDBBFBFRMWF7LQA6FfPU4cJiVeKXzK1SohnXEmcJw44Q/wfJHpy7xUSXPM1/mc60Flsrahq B00z6wVVXwWY4d3INWEiKz8EpfwBGoQZqX0Fme4AvbJUlQkFAi41bMhF6mnnz0IWso5yZV0o1o+WL HlOV5cFg==; Received: from authenticated user by zero.zsh.org with local id 1oNhr9-000AwP-Vt; Mon, 15 Aug 2022 21:42:44 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f49.google.com) smtp.remote-ip=209.85.218.49; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ej1-f49.google.com ([209.85.218.49]:42614) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1oNhlz-000AXJ-Sv; Mon, 15 Aug 2022 21:37:24 +0000 Received: by mail-ej1-f49.google.com with SMTP id j8so15657842ejx.9 for ; Mon, 15 Aug 2022 14:37:23 -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=Xnd93OQQV+B8eAid0rWeTFUnGaoD9VWldhyrbMxXVzs=; b=fUnU6b4O2cu4KfS2RFdLuqGF523ImS5NBHsaEEnBHz4xWs18rvGGVdozfnxdDTt6MH ClnVVTOVX24oFzBQMVbL4oEETYvI/HRX4vkF8uF2DCxBa/aUmJlJD4Ukuo2zViNU2MYZ kHYvX+iMGGDaBPYyzzoa4L22Mqv9n//CiKt14Pp+qGS9X3xtbDzqyTbFFV06pOKzaMG8 RsZW6VL1ocNbBV3wEY0xHa2r8FX03g6iYQ07qfwlYU0JbGHD2iS3eAdyC2TeOfTZWjjU c+uO6kP5U2rsZgVSANf5ti7exS/sA2S8Rs8DKWpZoLRJFTBJB2pzhJng+/7ZoFLGTwgJ Ah/Q== 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=Xnd93OQQV+B8eAid0rWeTFUnGaoD9VWldhyrbMxXVzs=; b=IIKzvEwH70HZlUyby9s2gg0ZKr1xmgOnNBc+dUoOxnapC7sCfBJ812DhLt+n3wUq7h SL4/x9oBUunwxSe4YOga53vfhgPJaw6OOkSpT3vPFIkYaD75xZ2ptx2cb/NdqRYPkfXt 9ufN+8Re8mZUp9LQCFIvlFfK9L2NPgbJ2aAK/FctEkZI4L01w389OeT6l84R0LHcai6m ybY6tVZLgX6kwpw0Gig4S443aa8rQSwAvjwaPv+WLxdQpVMO4Z1/ovqf33/H4cR4SCEC 8kiLJHuBugT9XCPcf1k0/rEbWYiZxMbkviolPXa1DC+0bS03nCN7xW6qKFbtwdEoiXxZ BYfQ== X-Gm-Message-State: ACgBeo2vNJc+cK4NhjjlE4MoAYWs64fZstOh0jaEh09nnEz9LipumSo2 19iBqiJP13hosk9Sv6PZkTzZ9CwauW8KKO7oUmH7gegvks0= X-Google-Smtp-Source: AA6agR6qmlvbTgLSqXV7mCGHwSU2RQ5o7WnWe9R2cEx0A3HvRrnd0FFuqajxw+2sziqziXOvbg35SrRc0hmY2HgnCMk= X-Received: by 2002:a17:907:da2:b0:731:60e4:2261 with SMTP id go34-20020a1709070da200b0073160e42261mr11436215ejc.679.1660599443603; Mon, 15 Aug 2022 14:37:23 -0700 (PDT) MIME-Version: 1.0 References: <20220811230901.471640-1-felipe.contreras@gmail.com> In-Reply-To: From: Felipe Contreras Date: Mon, 15 Aug 2022 16:37:12 -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: 50480 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 Sun, Aug 14, 2022 at 8:00 PM Bart Schaefer wrote: > > On Sun, Aug 14, 2022 at 3:47 PM Felipe Contreras > wrote: > > > > > How does one embed a literal ctrl-A or ctrl-B in the prompt? > > > > What would that achieve? > > Nothing specific, but one can embed any other literal character, so > why not those? We could make the code more complex in order to support doing that, but without knowing the use cases it's unclear how we would test that it works correctly and it's useful. Do we want something like "\001foo\002%\001bar%\002"? > > > I haven't found any readline documentation that explains the use of > > > "start of header" or "start of text". > > > > It's in the code: > > Ah, so "start of header/text" is your phrasing, not theirs. It's not my phrasing, it's what I've found these characters are called [1]. 01 SOH Start of Heading 02 STX Start of Text > > > I'm also leaning to the opinion that \001 and \002 should only be > > > recognized when PROMPT_PERCENT is unset. > > > > 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. Why would somebody do something like this for example: \001%F{red}foo%f %{$color%}bar%{$reset%}\002 Or this: %{\001$color\002foo\001$reset\002%} I can add code to make %{ and \001 be equivalent, if that's what we want to do, but how am I supposed to do a reasonable test? Cheers. [1] https://www.ascii-code.com/ -- Felipe Contreras