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 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30123 invoked from network); 21 Dec 2022 21:29:40 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 21 Dec 2022 21:29:40 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1671658180; b=JtxKX6u4LWTW5gQeqS0ME7yOUldOOfj2buI/monlZVE4dndohLBCkWlyzKkaqcQxx/5sv0iODA CkbGAaJ1fhjGlX7j1Wj3NppnIQzFwNpuy1NsERhdKSbdrW+rHYtSfio0aysfqiqyVUm1egy+Y7 JnPpcFS87gXVX0XCJJbLqutsX7LV4JsOoYffEPdbVnrM9bU7lmZnA418me/y5wkNpX2cgtdSLm x3dhuzY8Na038ijl259RuujRORrA1MEzq8ryOII2qwcIWPum//WaHlotj/a0MMyv1OJE537aAL yduYNIeprjBEuSe0BFiPe5DdhQGilRcSeOdgEQ8Ihp+utg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f43.google.com) smtp.remote-ip=209.85.218.43; 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=1671658180; bh=Hgn5EZRk/qs1cFtkUdtqxM2xVEpEMJqT7bMJvFbydlo=; 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=MMQly8vAFurmVGpwtLsWrdvwt7EpnBGysSN9aLVop6DKcE2aGbRPTdc2dGuXmVbABkOl7nUYGz 1u8pfiwe786Z+aDepJuUXHrZDtaZA3fXlIQiFFaKGdrCurbEnrWFgYCla4MT3qGg1GOA7hYKXK 1KE1qcSCJOaia2O22hRaB4ua1rVP8m2LNFUxvm4mU2qUmg80dlEW8KMwOUGb6XqddXWRDSQF4t YYTAF9oicjhBp4G+BCIupAB4C3m9G4B14MoXxLXobrVl9dgjlV3jAo9dtvtinifg4+PrrMmenf 4rXEw5CYfFErPBIw7QfR/dTYvYD+27GpwCzeAotSOxk41Q==; 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=KL0D9Xej/y89c4YKsJVhYmIUBJCPWEM3vgKpzBc2tq0=; b=IvP+Mg3UiLO45aHW6HKd0nCm5w YUkQ4D4P9bqKW8sGoXjKmzQyv5sJQRANrmin5cGbiyE5vM7uikLTs0LsO4kkaOamhXUii8eHK3Xt/ 9/pE2uBkGimRIkRi9GoW76XlFuEoykgzLhQ5k5XjHMcVkdwSTYii6B6XI7jzrpnt02zqo8eV4VOoO /FP2koqHk4Q+V2nvo3zSkHFXmk3C654eDG+hQ4FEXRXbDY/LGguUultLiAtgYXOV5ZcLl+rxYtpSl IWMpcM0DW06MA/FPgf70nAjObl6dhZwnzBDBzFB3u2SnOs8K5C7HTxj+0ULV9RIzi9S92ePAjskM9 UPnhWKug==; Received: by zero.zsh.org with local id 1p86eh-000OLu-VC; Wed, 21 Dec 2022 21:29:40 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f43.google.com) smtp.remote-ip=209.85.218.43; 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-ej1-f43.google.com ([209.85.218.43]:45797) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1p86e9-000O3N-Cr; Wed, 21 Dec 2022 21:29:06 +0000 Received: by mail-ej1-f43.google.com with SMTP id fc4so513704ejc.12 for ; Wed, 21 Dec 2022 13:29:05 -0800 (PST) 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:subject:date:message-id:reply-to; bh=KL0D9Xej/y89c4YKsJVhYmIUBJCPWEM3vgKpzBc2tq0=; b=71JZaiN7QsuAQggAtmoy6R7Dh7L5s7fJxYdG5dXVBgiCgabViswnyxYAncMLCOGuxP FUwfpjKa//mtOTva3ZG4FJpRH3dUf3d+cSeR0JbUIswJ907L6n7z80f/iAd70rTr+uWB gAa3E4rxVNSn4asoY8QB3Y4t007Zs50pxLjFT3mg2DEICZ1mKRWSgO7TrBuCc2aEem9h wS2GOASuTBi7yme6mo2/f2n3PzubfjY5fOYAzY1452wODMMLlrUEigXkVCaz9TV2lgS/ tVPg9uHfJyu78Q7a8k8eBCoukMkyqWECK1YCjSbVEtUlpIsHEnocXEBxtSUbaL8Q5xyN kN+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:subject:date:message-id :reply-to; bh=KL0D9Xej/y89c4YKsJVhYmIUBJCPWEM3vgKpzBc2tq0=; b=DZTrmRSBKxs+dFiY+DJ2UQDI0kaV/KVmxgsUwHOIBU8wRI3nvRX58uBkEA32Y9QKxy rkhC41qzmjjvLEVKDy8kyuRX25I9tOI1sdsS5txAe0+e56ep1YBZMTnVttTBGlhAWRai Pfx+yk3i5z3KkVzTSRZTVneso7JSCgJaIfKJ2gXMicGysjOu1mw44iduCXTUb6yQiMkj PzPyYNJHGvWXtEHH0hmt0XCyUpvEAfUPDWzJe4/xvRVTuWU+aSX3JYTIQGc9mSFswbaM gduEvNHWvaH/zs6e79hPD+sTKvzgEGE6kEFToOYIg9hDQNDqyli5i2NBMr1A2JCJ6anY hOow== X-Gm-Message-State: AFqh2kq/MQszk7rmUt85qEGHk+gcA50CJzYRuowSt3iYGrrlKLGCKpDC 46z6zfdRfMkAQVRYVZ/L1N5kBft+3Cg3ziQiHEtyrw== X-Google-Smtp-Source: AMrXdXsvIFVyh+gh0UIaFO7UupB2EzrYcciyuVxZAkSO+/teuIs+twcv0I4A40caF+v5Zs8Ns5rFIISayZ0Qul6gFrs= X-Received: by 2002:a17:906:495a:b0:7c1:449b:dabb with SMTP id f26-20020a170906495a00b007c1449bdabbmr192964ejt.732.1671658145047; Wed, 21 Dec 2022 13:29:05 -0800 (PST) MIME-Version: 1.0 References: <37998-1671237833.378022@KQt2.DuNm.SJtt> <89232-1671270468.081657@opLX.-aX7.RvZU> <33684-1671641189.906535@VXy1.awnj.CFc3> In-Reply-To: <33684-1671641189.906535@VXy1.awnj.CFc3> From: Bart Schaefer Date: Wed, 21 Dec 2022 13:28:54 -0800 Message-ID: Subject: Re: Turning display attributes on / off in prompt strings To: Oliver Kiddle Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 51247 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, Dec 21, 2022 at 8:46 AM Oliver Kiddle wrote: > > The original problem was due to mixing raw sequences with prompt > sequences, right? Any time we produce \e[0m we lose everything from > the raw sequences. Sure, but the idea is that we'd stop producing \e[0m and instead output \e[24m to specifically turn off underlining. However, if suppose the prompt code has seen %S%U and then standout (reverse) was disabled by a raw \e[27m, but for %u we output \e[24m\e[07m because we chose not to re-optimize the current code, then we've broken things in the other direction. Ultimately there's no way to keep track of what any raw sequences have done so the best outcome is to do as little as necessary to maintain the state implied by the %-codes encountered so far while also making the state change requested by the next %-code we find. > Something like %u in a prompt will always send the > off sequence regardless of whether underline was previously on. If > we optimise that, we actually make the situation worse for mixtures Right, we always need to send something. We can't optimize (e.g.) %u to less than \e[24m. > underline on might have been done as a raw sequence. The only way to > really solve that would be to parse the raw sequences. Yeah, I'm not suggesting that. It still doesn't work for e.g. using ${(%)%u} to find the underline-off code. > The zle code does things differently. [...] > It'd be good to use the same interface for prompts, preferably also > dropping the "NO" forms of the flags to free up some bits to add more > attributes. Zle has the advantage of always being in control of the entire state, it never has to worry about attributes being toggled "behind it's back" or to figure out what to do with ${(%)...}. > The glitch handling using the "sg" and "ug" termcap sequences also seems > to only be done for prompts but not ZLE. Do you know more about this? I do not know anything about it other than that it's for slow terminals that might not be able to keep up with the control sequences. Wayne would be the expert, I think.