Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: End boldface also ends background color
- X-seq: zsh-users 21401
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: End boldface also ends background color
- Date: Wed, 23 Mar 2016 18:53:56 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=WVCglHkqs7+mkf+y5xG9X69v8XxN1uFMRQvZCXLL40A=; b=LvcHi76mkdtP5NZlxRosmT9KhjDYarHJFnyF5gQNLftixEk4dSUgiMv8K22oBAvOeg pRdZDmeclggy7TgeiU0EtWfoiPU+LWvGCb3CWFe6Al0lWo6JuaIztbErotxI6Zjos36v 8gPNR8NnJVCGh1PxRJ+6VFskWea/6nsyy6AxaaBNmZh/e52N+Td2cf+ro3byvokNW97X S7xcFrdCWCfIyL/Wv6Z4OVOInIxWDPGLHv8V9mN6NKHtOUF0siSx7xz5RKlCruWaf/a8 p69G50ryb0LK9pH65Ph0bnHCSzW5RLq+bD015Zqyk6Qrbyyyi+SQvgNKH6hDZaCf1KF7 VydQ==
- In-reply-to: <CAHYJk3S_837wMcu0VgFkuWmrFsmdGT6Tqg4euxvjky=8HOfuGA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAJjRh0RPasUzjZr+RFmdTGZLs_gpgx7fb3XjT9uEOSAtpNmgCA@mail.gmail.com> <CAHYJk3S_837wMcu0VgFkuWmrFsmdGT6Tqg4euxvjky=8HOfuGA@mail.gmail.com>
On Mar 22, 10:00pm, Mikael Magnusson wrote:
}
} The code for ending bold sequences is usually ^[[22m but %b sends
} ^[[0m which resets most things. As far as I know, termcap
} unfortunately doesn't include the code that only ends bold, so there's
} no way for zsh to know what it is. Zsh doesn't hardcode any of these
} sequences because they can vary across terminals.
The code for this in prompt.c is interesting:
case 'b':
txtchangeset(txtchangep, TXTNOBOLDFACE, TXTBOLDFACE);
txtchangeset(txtchangep, TXTNOSTANDOUT, TXTSTANDOUT);
txtchangeset(txtchangep, TXTNOUNDERLINE, TXTUNDERLINE);
txtunset(TXTBOLDFACE);
tsetcap(TCALLATTRSOFF, TSC_PROMPT|TSC_DIRTY);
break;
If you look at zsh.h where the TC* flags are defined:
#define TCBOLDFACEBEG 18
#define TCSTANDOUTBEG 19
#define TCUNDERLINEBEG 20
#define TCALLATTRSOFF 21
#define TCSTANDOUTEND 22
#define TCUNDERLINEEND 23
There's no TCBOLDFACEEND, which I presume is why %b resorts to turning
off everything. But I don't know much about how the txt* macros work.
In any case this code pre-dates the ability to set colors with %F by
several years, and probably wasn't updated when %F was added. Given
that the color attributes are stored in the txtchangep set, it should
be possible to turn them back on after TCALLATTRSOFF disables bold, if
somebody who *does* know how this works wants to dive in.
Aside:
The doc for %F references zle_highlight which implies that you should
be able to do %F{bold} but that doesn't work, and the numeric color
values supported are not the ANSI color attributes. The doc should
probably be tightened up to reflect this.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author