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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3145 invoked from network); 17 Dec 2022 09:48:29 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 17 Dec 2022 09:48:29 -0000 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:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:References:From:In-reply-to:cc:Reply-To: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=e+6MM3jyiX6y87Lw3S4bd+O1x9w9gFmDYI5c6C0RgDI=; b=Mgng/AitM6C0bAnsmJkSQt1qtM 6TGjIR5zpLE/sAwsGXbUmsk3VLy+tQUL0TRK1axj7himI/TUpJ86D9E1Og+7PZ978XI54Mpgk21Vg O7qUieagFAy+aXTM5Im29+ZYgJRH4TPphG9QTbqWqLWHDe5J3y1TK7NEk9Gqf5ETn/f6sHdNF6QYH ciUft923PbjuNzsvMiUENvmkxFdQnL3q3Z+5OyZUVYwnWOWup4vC8wEIHrqfNToDfVSMHovoRz+Wd px26znNQz8d9iE1mpERaNZ9d+twQblS7aIP1iRBAs2hYeocsP8aZOq1wDVeMHreH/zPUnoJGFIL1h xJXAz4DA==; Received: by zero.zsh.org with local id 1p6Tnw-0005d2-QV; Sat, 17 Dec 2022 09:48:28 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1p6TnL-0005Ib-7t; Sat, 17 Dec 2022 09:47:51 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.95) (envelope-from ) id 1p6TnI-000NDF-6f; Sat, 17 Dec 2022 10:47:49 +0100 cc: Zsh hackers list In-reply-to: From: Oliver Kiddle References: <37998-1671237833.378022@KQt2.DuNm.SJtt> To: Bart Schaefer Subject: Re: Turning display attributes on / off in prompt strings MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <89231.1671270468.1@hydra> Date: Sat, 17 Dec 2022 10:47:48 +0100 Message-ID: <89232-1671270468.081657@opLX.-aX7.RvZU> X-Seq: 51232 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: Bart Schaefer wrote: > A consideration is that if we simply replaced $"\e[m' with $'\e[24m' > and so on, the present prompt code would still emit the > then-unnecessary sequences to restore the other attributes. Is it > worth the effort to rework that? It's probably not worth replacing the escape sequence without also allowing it to avoid that because the original problem would only be partially solved. > > And if we need a way to > > override terminal settings, something more generic may be better. > > Would populating a writable special hash parameter be a security issue? I can't think of anything it would open up that isn't already the case. It can depend on what you regard as untrusted data. > As you implied, though, the hash key names could be tricky to choose. We do already have an interface in the form of zle -T transformation func Transformation is currently only "tc" for termcap but something for end bold* or general attribute changing could be added. Prompt handling is in the main part of zsh rather than zle but the zle module could define a callback. The existing tc transformation interface doesn't make it easy to modify only some capabilities, you'd need to reimplement tparm(3) in shell code. A function provides maximum flexibility but could be slow and a string would suffice for most uses. A hash seems like a nicer interface but we can have a transformation function do the hash lookup and keep that in shell code. Oliver * \e[22m selects normal, disabling also faint so naming indicating end of bold would be a poor choice.