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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9383 invoked from network); 25 May 2021 22:44:31 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 25 May 2021 22:44:31 -0000 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:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:References:From:In-reply-to:Reply-To:Cc: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=aFY5MYZ10hKrFd4L7JnG0jMx7Oj4tIQAEYmD039NlPI=; b=M0GsZd3EEF85JVw3psgjw+rFd4 ncHTnnI9vxS2ZxO20K+609jb/s0P227t7NDmeLKKxMDCGyeObae07z/CWDBwcft+BYOSAARzVCSUG +vhJ09qzbK0/VEiII+cCah0QVMuG9dpKD1hNJHvnC/ygbONglMgeBwkvv0WBEC4QrxMtqt7Tx1kAE IcVA+5Ccf6Lvv7LjvVDBfYJBqTiQVNBLEEa8vM2WT2SZFLjGaAfsJSPol7f6xI9Oa4Cd7PnJJeyB9 2uQw+b5sWIQqOKRYpLJoSjltiPpYYq4a1cDGsV49mZiVGTZqJReQ5j8LvNwIr5I4b6CmVz9CwnOSy eK6hk5RA==; Received: from authenticated user by zero.zsh.org with local id 1llfmp-0007nY-C8; Tue, 25 May 2021 22:44:31 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1llfmJ-0007Uf-CY; Tue, 25 May 2021 22:43:59 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.94.2) (envelope-from ) id 1llfmH-000FVn-EI for zsh-workers@zsh.org; Wed, 26 May 2021 00:43:58 +0200 In-reply-to: From: Oliver Kiddle References: <40813-1577992732.270919@2Jfy.SNk-.4lUU> <20200103202807.cxocci634aksqwot@tarpaulin.shahaf.local2> To: Zsh hackers list Subject: Re: Feature request: italic style in region_highlight MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <59629.1621982637.1@hydra> Date: Wed, 26 May 2021 00:43:57 +0200 Message-ID: <59630-1621982637.439991@gOpL.wWUN.wfpJ> X-Seq: 48934 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: > On Fri, Jan 3, 2020 at 1:05 PM Daniel Shahaf wrote: > > > > Why would we create either %A{4} or %A{04}? The API to script writers should > > use symbolic names; the API between us and the terminal should use terminfo > > rather than hardcoded escape sequences. > We've already found in another thread (the one about %B/%b) that > terminfo is inadequate, it doesn't define escapes for all possible > ANSI combinations. In this specific example, %A{bold} has no terminfo > equivalent to turn (only) it off when %a is reached. Inadequacies of terminfo is even more reason to only expose symbolic names to users/script writers. We're tracking the state of all attributes and something like print -P '%B%U hello %b bye %u' Turns off all attributes and then turns underline back on when it reaches the %b. Whether we want to hardcode a raw escape (such as for turning off bold) comes down to how portable it is and whether it brings us any actual benefit. There are times where the remembering of attribute state is actually a nuisance. In my own .zshrc, in a loop where I build up associative arrays to represent attributes/colours in different formats, I need the following to reset it: : ${(%):-%u%b%k%f} What isn't so clear is how the %A{ interface should handle turning attributes off, either: %A{italic} ... %a{italic} is needed %A{italic} ... %a where we remember what the last %A was %A{italic} ... %a where %a turns off all attributes %A{italic} ... %A{-italic} Those options aren't all necessarily exclusive. Also, what about allowing %A{bold,italic} or even %A{fg=208} ? Oliver