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 26951 invoked from network); 16 Dec 2022 19:46:12 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 16 Dec 2022 19:46:12 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1671219972; b=rFniDbSeCAACtOECvj1zS5nGAKYdi6hVADjQGTjLMGEI6TOz2L83ZRpBwgWOTmmhkguYLqbNRJ jYujJKbYtahbsqGQ71uuE7vawBockqI3q/WNuNdN8RERZArpOUkvn+yrHzdjWbFbLNcvRN22sB 3zHK2vCL6FoSujUkae3BCLStPfOTQ4Je/l/awGM8uzgx1aR0NYLGq/5vZVHYf+wW8dYe43Q0LS kS4RVnT5wVoMuYwqIdpuVGgjtBAUHdFY3IOfO9k7n37LfEPy53J5F2au95rLTQhDolQkwFX+DV xu4d1bThKeAJF1426fDz5/fORLf/XQbDHcCWUCX8/tjqfg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f44.google.com) smtp.remote-ip=209.85.208.44; 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=1671219972; bh=4G2TsXXY6cVTLk6JCJjtmV6NTKnI2fq18wdHM44A6NE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=AaTqJpVK38FayR6cSLy4VKK2VyQXPr+zj8z8k2zvmTOazEILzDXZmmvivifBndqalMDiFeFVV6 qvUR7DkZlBzPgqAdN5+NBYbjK/GuptJ2VsU1XC/7K4s2Vs5HoExLO+12wCkUXJxailfSebR8em wlxxR6fFZyFfSr6Km4oymARi0IK4sAaK9wX18fgQB6ROTUc3P0Cbp8nvg9zWtL83QZPuymxdDG FVporL6F5DrO+QspPyLK/jisCOCVuk614SIWSDcIhfpbiB9HQCIeuO1D002AEBpcFHmPaSex7+ AsN8Opju7oMpDA/a2mnkP66HI5iKe8L5cyamRcelObPUyQ==; 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:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=lTi4e90aClEqP4xIrhDqAh8AfQuTpTTYvyWcXHJL1Rs=; b=WGvUYDLNJhBmhQwWVaYbvv4QMO 4MJZuRGSmolF1zXVe2wCPPzMt78u3hMK/UQY2QlKQsGBRTKmivXEeHxTdAxtSELKa4SL6oEA6JE6k IxEGD5KUfV1mNXyiwQtwKh+/d9rKQ5jE28WDtnQvhZdE9npLkhhJixm8dDWjLVb6fCW1PP1uLZIFx W3ofSLx1Zz1IBldR3PauoyEaY/BHTr/NDhn43T1FRk3m909YZSf8pG48BjUyPJO13zv5mW659ABaQ WLPJVLHwda6u8iDPrJfKGC1Gt5PqGU1H7TzuDdGQyYjCIv1paXtIJbma/b7GvUz3jmf2evAMB+jZT cZcqxJzQ==; Received: by zero.zsh.org with local id 1p6Gep-000Mik-57; Fri, 16 Dec 2022 19:46:11 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f44.google.com) smtp.remote-ip=209.85.208.44; 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-ed1-f44.google.com ([209.85.208.44]:46712) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1p6GeD-000MPC-I1; Fri, 16 Dec 2022 19:45:38 +0000 Received: by mail-ed1-f44.google.com with SMTP id c17so5041020edj.13 for ; Fri, 16 Dec 2022 11:45:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=lTi4e90aClEqP4xIrhDqAh8AfQuTpTTYvyWcXHJL1Rs=; b=k50WHjdHfk9UZAspE1qfkWekbkYkr+2QcDJnhNuhilnGZ2THchB3zg0hRYZB831CMj dVJXpDKHFa4voLZRssqinxvLr86xb7QVUuQYqPV8JdDXFQaxnxIMe4gfKLg376HSiOOZ rNg/KLAjMFGikqh0Uz/Our4cGh4C6FEId/WuiDyq+hGfgjvrRsyEQGrTM7ye7j+w3KAU bLCZA2pweEhbuwUdeI8bVEVizCwGJOvQwZ5YgBg50E2g5COEZYrfkHeL4DCaPOryKQ+4 80jytBZoV36IMZVkyzfspLaF+XsnVcKeXjwEJNw35APXc9BwawC82SlNwRxGwIKYQ4KC G+pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lTi4e90aClEqP4xIrhDqAh8AfQuTpTTYvyWcXHJL1Rs=; b=Dx9lxv4mUSgLtPpjI3ZO52Qgndq3PLMzBGgpzlg+uKhL0EatUur4Gmk90BAsv4BFze udut+T/RikbvXZXBxOC10IX3K1ZhKNqBSHZGhkjfM/DGDTPhKU8fbsy3BOEku3PoOQRd jHEIYvyUrP+Ks3ODzJm93gYuiVJLkBWifGBVqQEhNIlzFFt9Igzc9IOD3hM5PKNNZZEi ZtvFspLib4mUolroHgoTMK8cSWofks7gMrhewmz5lLI+fDN2AzMWSazq81UBUyTGdR9G mfwIMHDqHJAWHtmsM+tzS5qBavUivLZBaEj1W75cC8OuNa0yhWZddb30LPwODmgMi6JW pRdA== X-Gm-Message-State: ANoB5plmfrzvoKJ5KS1B/4Z/ejAZx4ZbqIGhKl/aMf6z5LHVmRuHst60 GSJV0MfaBcHpsbN8JqWFW+JRnSuP4m2UmhgYCyU+M2Nyva90iI9Abm4= X-Google-Smtp-Source: AA0mqf6/wW4X4M5JxfErEc8zIL060zvKSjFt4CiTGHlfeFyL/GzY5k1rGpd9YDReBHJXx/guXepIih8cQpIIBWj+mY4= X-Received: by 2002:a05:6402:500d:b0:46f:ba33:c767 with SMTP id p13-20020a056402500d00b0046fba33c767mr2721305eda.366.1671219933097; Fri, 16 Dec 2022 11:45:33 -0800 (PST) MIME-Version: 1.0 From: Bart Schaefer Date: Fri, 16 Dec 2022 11:45:22 -0800 Message-ID: Subject: Turning display attributes on / off in prompt strings To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 51227 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: Reviving another old discussion ... On Tue, May 11, 2021 at 3:18 AM Mikael Magnusson wrote: > > On 5/9/21, Bart Schaefer wrote: > > > > 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? > > I think that's a shortcoming in termcap and/or terminfo. In termcap > there is md (1m) and me (0m) that should correspond to bold, but 0m > turns off all attributes. Compare with us (4m) and ue (24m). So ... I've been playing with this, and on my "xterm-color" terminal se and ue are both $'\e[m' -- and yet "print -P" and ${(%)...} and so on do "the right thing" and output extra control sequences depending on what other attributes are active. For example print -P %U%B%S...%u... outputs $'\e[4m\e[1m\e[7m...\e[m\e[1m\e[7m...' -- it has recorded (txtchangeset) the three attributes and then properly restores the ones that are not intended to be turned off. 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. > 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? 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?