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 1976 invoked from network); 17 Dec 2022 00:44:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 17 Dec 2022 00:44:33 -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:Reply-To:Cc: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=9or8CHKozoK5q2QyO91bffftqcKFrHnArosHzfgobnA=; b=nkCYFdQFykJ55/0SSSsqOykZYu g4tl9P+YlJUZS2TRVKNzMYDHqdThoPRBEz8Xa8VtzNL/nCnUM+FjqJF86tszDlmkCdU5eIYw2s9ti NZjABNDTlLM7lEx0RFnFg+XC7ow5pNdldxkqzti4Q3n+8hXxMeToMq/Y8n0GgImArGN7Gd4+y04vl x9wDHtpVOl4Xz0qKZNd3VjGukhJAhAGEM3smNKVWKq5K3TlGRPxOaBoyO6pF5nLeParUiu/r2zTQ6 8deL4/K6Z9iHugnWm1V3rQez4yRQaEFt5qLBE5rIYMFqwVF/FMrjvKSLIIN8YrRh7X8LPKfaIheek 5MHA03Aw==; Received: by zero.zsh.org with local id 1p6LJX-000Fmw-S1; Sat, 17 Dec 2022 00:44:32 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1p6LIy-000FTh-Up; Sat, 17 Dec 2022 00:43:57 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.95) (envelope-from ) id 1p6LIv-0009sv-Dp for zsh-workers@zsh.org; Sat, 17 Dec 2022 01:43:54 +0100 In-reply-to: From: Oliver Kiddle References: To: Zsh hackers list Subject: Re: Turning display attributes on / off in prompt strings MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <37995.1671237833.1@hydra> Date: Sat, 17 Dec 2022 01:43:53 +0100 Message-ID: <37998-1671237833.378022@KQt2.DuNm.SJtt> X-Seq: 51230 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: > So the problem from the original thread (workers/48800 and refs) is > that you can't mix in "raw" sequences for attributes that prompt.c > doesn't "know about" lest those attributes become disabled every time > %s, %u, or definitely %b on any terminal, is used. It can also get confused when you assign the results of ${(%)...} to a variable without printing the results. My .zshrc contains instances of : ${(%):-%u%k} > > https://www.gnu.org/software/termutils/manual/termcap-1.3/html_chapter/termcap_4.html > > also implies that there is no specific termcap sequence to only turn > > off specific appearance modes. > [...] > > Since we already assume ANSI for things like colors, I don't think we > > would lose a lot of compatibility in practice if we just use 22 > > instead of 0 for %b, but we could potentially put it behind a setopt? I'd be reluctant to create an extra setopt without first having evidence that terminals that need it are still in use. And if we need a way to override terminal settings, something more generic may be better. I like tmux's terminal-overrides[] but that's tied to terminfo and the premise of this problem is that there is no termcap/info entry for end of bold. Maybe #ifdef around it and add a configure option that we can remove later. > In connection with Oliver's patch to eat CSI sequences ... perhaps we > should abandon looking up termcap strings for these attributes, or at > least have a fallback to the ANSI set when we encounter a termcap > result that's not specific enough? If we allow ourselves more assumptions about escape sequences, we could also make zsh an easier experience for new users by binding a few more keys by default. There even is termcap entries for some. For a very long time, I've taken the approach of binding nearly all sequences for every terminal I use rather than using case $TERM and the superfluous bindings are harmless. Oliver