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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25362 invoked from network); 9 May 2021 20:50:35 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 9 May 2021 20:50:35 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1620593435; b=u9qzx9oAUEanx1ZLDIKkBipF6nlv+DT5QUb8FnbpUQevfyZhFincj7fh9wc377XQ8uQo9eI3a8 xCR++Mu7P3q1E+4e7GpmUcMuCsEyZ0NiZvGrT+6fo4A+lO3FgBhypXfg76ZQy83xg7Q6sidIIg 7CpDU2cKhnBzKgvkoxe8Qtu+VBowF8o/IkIRA/mVLaPyDrwxRDuXeWpEERQMoaaWs5nVArIwL/ v96mnJx1JuiHHlw0bLRzROT9j3RmC/NKGvZ07SshAMpMHz5mYXuhtJamGygt1BAIBKSfnYgmWZ wCmB4WdToxwPJYlFTnJuBk+Kxud+8lbAqhL5L2ULoZIOYw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oo1-f52.google.com) smtp.remote-ip=209.85.161.52; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 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-20200801; t=1620593435; bh=afXOk8XhO+WFDSqROZPgkjq8IhJ6ztpJQpmjQpzWCCw=; 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=gLyVTB5cYWtZup5QSb2tMqwaOWhDFpvNbuQ4VM+GAsb4PUfQM+CzXs5Nw6jkQdGV9sqs3ITdKX 6Xzaa5hlpanTBzMW4kTYUJdtezXmXnwXOlEBZRSNBKoL9vWduUtgLLo6TaCuT3GsDgWQBHHGeX vcp544b3XvbS5j413okszizwzfcUxFg08DGv8NDzzKX34/lV69yb39K3d71iUoOs1rkwT1SzOb 1bId3yzAmzCDj/bUZNpSHvfuhML3PnF/rmnP4nkjqMz8009rSksKh8MFEkjTyohP5XbPy1Eben jJTv1/If9OVhgE9F8QLLzfw8/rrr0qDDnRkSfnsSdbL/0w==; 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: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=afxVmHRfqQjkrY8QR3ZPnAQPIwhseCzG8kmo5VdSeEI=; b=XuKgIefcsOAGWzwYEcC3hxun07 oK0aRpaaEmauArAaQPET9x44piYb8oRZ05AuQU1CLrqDk+HZdtYNSbCLkOwmp0VOg5zutrdF7GJXk EoHQekfc5DeqMHwdlPJG0F5iRWvKJnjuhd4NOFUqSb8w0esEqvw1uhoowv8gz5RSWYQEkU+uC+MpN n2/Cf6pDyaPMPHjcLqwtNZcZfTDT2eFqphnKQrpCTcr95zWvFmRDeJPWFoRbnNsqouinxH9tYS2/i LIPTpRjHirVTIj5Grmss/uA+Bdo4Ggx8tR0NmXvhDIdfTwCe/TS6LUxoEv2/KcoEEfLKO+SVBJyV9 /THKzOWw==; Received: from authenticated user by zero.zsh.org with local id 1lfqNn-000CsG-9b; Sun, 09 May 2021 20:50:35 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oo1-f52.google.com) smtp.remote-ip=209.85.161.52; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-oo1-f52.google.com ([209.85.161.52]:35718) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lfqNW-000CZz-Vo; Sun, 09 May 2021 20:50:20 +0000 Received: by mail-oo1-f52.google.com with SMTP id s20-20020a4ae9940000b02902072d5df239so588504ood.2 for ; Sun, 09 May 2021 13:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=afxVmHRfqQjkrY8QR3ZPnAQPIwhseCzG8kmo5VdSeEI=; b=1Gm2BhYtoc7hxRM3pEhr+wvSO775b4pgcy86mb0XO++Kp/37abTwJibLkD1R6YF2qO KZlb8Irq6fnjmkqtObdLgcy6GgvRmUG4F4V9QBC2mNY86hXU2HdAKjs9tR20J/68LajL s6zb4pOy/yJStotbJGK1RVfRnhFwUMo5WAuR2Tj+llB0fKumCr046ZEkiqyyrPj5/SMT jZRLtdyDLHXPLcb4lPe0mI0Bp2O02o/mcqZbs4mklUSTLkMTfxiS62EbHiU5z98KwQV6 RcHQlToXAbPtnEpnE+j3zTtdy7OFs5xy3rt9XTu/NijHLIHyr1LKZbzOS8lNKXsw41De PhPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=afxVmHRfqQjkrY8QR3ZPnAQPIwhseCzG8kmo5VdSeEI=; b=M3FIJR3CxXt5nAlOaD0DsIJ0iN4rKLBjeSalGybpr4bzLEd+pT+Lbt9sZJRaOsdDX1 LlIU4xe1vaNIJ6EL2lRWokX0q+X81zkhhaaTMj1ghq3RLNX1ggsT0q9W8top6biSL2mE OD5Nr2jom/GEY+XEZZ4R8rCgOwhKL0nSzU9Vgi825Up2oaoQD6jfQBET9TZc9TUTMbVi 2Mc2B84rgStcxPGg94wlZWAVSg6FzBpPqbwKawzO/LQW4C2b8oh2VzlDNN9HBbGjw/o/ 999CZWK9dmHj8CnMSfoCRGQXuyIpYD1zYmuG3Eka9STXnbzaeQWh3SW6xR8UzWBL7MLx U7Zw== X-Gm-Message-State: AOAM533DFDRgLnJY/K6PUZRyVtUFPadikAi8MCibRO2FfUVK4z6CwHso NDiNi738SjtZi5OpnRYxBAvkp1T+nTf6WcM826nlZg== X-Google-Smtp-Source: ABdhPJyMKBWjRdDb2/4OED8G+gKOqn+CsIUIseuGa4LsqHAyHlYV0/GDV5X0A9A1m07+nzP0QLYSHE9GL9Br6pdWoo8= X-Received: by 2002:a4a:c446:: with SMTP id h6mr5519580ooq.82.1620593417776; Sun, 09 May 2021 13:50:17 -0700 (PDT) MIME-Version: 1.0 References: <1185563186.165566.1619896723304.ref@mail.yahoo.com> <1185563186.165566.1619896723304@mail.yahoo.com> <1293997275.666259.1620093977494@mail.yahoo.com> In-Reply-To: <1293997275.666259.1620093977494@mail.yahoo.com> From: Bart Schaefer Date: Sun, 9 May 2021 13:50:06 -0700 Message-ID: Subject: Re: Suggested improvement for sticky-note To: vapnik spaknik Cc: Zsh Hackers List Content-Type: text/plain; charset="UTF-8" X-Seq: 48800 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: Just now getting back to this ... On Mon, May 3, 2021 at 7:06 PM vapnik spaknik wrote: > > The attached diff (against the original) ... is still a file with the ".diff" suffix instead of ".txt" ... > adds options for selecting a background colour &/or blinking when creating a new sticky note, and automatically adds the appropriate escape codes. It also adds a help option. There are a few reasonable suggestions here mixed with quite a number of things that could be improved. Adding noflowcontrol to the setopts is probably a good idea, and passing "-e" to vared should at least be configurable. That also caused me to notice that interrupting sticky-note with a keyboard interrupt (^C) can cause old notes to disappear, so that should be fixed. Help text is good if other new command-line options are coming. On the flip side: The ad-hoc option recognition by pattern-matching "$*" is going to be error prone. Previously all the options were mutually exclusive so just testing $1 was OK, but if there are going to be several options that can appear in combination there ought to be a call to zparseopts (or at least getopts). Hardwiring two options for color and blink seems pretty arbitrary (compare the "escapes" style in my patch that selects among three variants). What if someone wants italics or boldface or underlining instead of blinking? It's a bit strange to use $(echoti blink) for "on" but then hardwire $'\e25m' for "off". Anyway, $(echoti blink) just spits out an error on my terminal, which the patch doesn't account for. Having the note blink while it is being edited is rather weird/distracting even if you want it to blink when displayed later. (There's a reason web browsers dropped support for the HTML tag, but we won't go there.) Also, during editing the visual changes are part of the vared prompt, but then are stored as raw ANSI escapes in the text of the sticky note itself, which will have odd side-effects when using history to access previous notes. This is a mixing of metaphors, so to speak. Visual changes are in the text but the interpretation of bindkey sequences is done by "print -b" after the text is read back from the file and is being displayed. Even so, the raw escapes only work when combined with your -B option, because if "print -b" is not used, the ASCII 033 are converted to "^" "[" before being sent to the terminal. Finally, you've embedded the definition-time theme color in the note at the point where blink is turned off, so if the theme changes (new zstyle applied) any notes that had color changes or blink will revert to the previous theme's coloring. In fact this makes me aware that it doesn't really work to interpret prompt escapes, because (for example) after %Bbold%b the background color reverts as well and the rest of the note is no longer yellow. It's going to take a bit more thought to decide what it's possible to salvage from this, so no patch yet. For any other zsh-workers reading this: Does anyone know why putpromptchar() has this? case 'b': txtchangeset(txtchangep, TXTNOBOLDFACE, TXTBOLDFACE); txtunset(TXTBOLDFACE); tsetcap(TCALLATTRSOFF, TSC_PROMPT|TSC_DIRTY); break; That is, why TCALLATTRSOFF ? That isn't done for %s or %u ... why is there no TCBOLDFACEEND defined?