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 25333 invoked from network); 8 Feb 2023 22:52:37 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 8 Feb 2023 22:52:37 -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=df9VkwYsUY2U/GqQLwdK1I5mCDRSDVIrrS5WJl9uTQ4=; b=SjDpTd5FUHlOTi3M02VO4QZ/SB XfvCOW48XVPWi7SPtLTVRqvWc3wFtcSovoNf3HGh3W2Zz5/UBt4sEqEHYiP0vZN1KCH28kECho7FC Nj0zH+kyl+8bqc5FOGmcj2k/qa21Udb68b+aFewArcaEI/mc1TUiXfCUwpLb2kWHa45BBTkXTieM4 R+Y3yMqq+w+9ctZikPJ7cBfqWC8CNX8C+YIA2wsHme8tglZaFiTIgLwobalf213haVkHJj0gpmvmT r06fkeUN5kftZah2OxSN3+qGxQNjhctPFhkjvrhQYd9yKcOwPPsRrGsFe11JAoGXDkf1aLXRoqsYO V6A6vmaw==; Received: by zero.zsh.org with local id 1pPtIq-0001kV-Ta; Wed, 08 Feb 2023 22:52:37 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pPtIc-0001Rq-GB; Wed, 08 Feb 2023 22:52:22 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.95) (envelope-from ) id 1pPtIb-0001ha-Ks; Wed, 08 Feb 2023 23:52:21 +0100 cc: Zsh workers In-reply-to: From: Oliver Kiddle References: <36223-1672793943.791824@SLuG.9t5a.jH-P> <2468-1673042601.684998@j4zI.qkM4.yrwt> <51171-1674163110.743900@w5-F.JofK.-02M> To: Mikael Magnusson Subject: Re: PATCH: support for italic and faint fonts from region_highlight MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6544.1675896741.1@hydra> Date: Wed, 08 Feb 2023 23:52:21 +0100 Message-ID: <6545-1675896741.640027@NF2k.rdHi.8Dac> X-Seq: 51383 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: On 20 Jan, Mikael Magnusson wrote: > Tha patch seems to fix my blue problems (but X04 is unhappy). Thanks! This requires a change to the zpty_line() function which is one of the functions handling the tests. With the earlier patch, it now clears the attributes after the first \r. So stripping [[:space:]]## from the end of REPLY was leaving the \r\e[0m in $REPLY. Bart wrote: > In a shell running in an emacs buffer, I get ... Given that for TERM=dumb it is quite valid for %s and %u to be empty, the test can't rely on that so I've removed the two -n conditions in the test. This does slightly limit the scope of what is being tested: I took care that ${(%):-%s} does give you the disable standout sequence despite not having turned it on before. The patch also does some handling for leaving attributes on at the end of zstyle ':completion:*:descriptions' format That was possible before but with behaviour that can only be described as a mess. Turning them off explicitly solves problems. Sorry for having been slow to address these things. Oliver diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index 8bdf1bb29..9cb89a60d 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -1305,6 +1305,8 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop) } } if (dopr) { + treplaceattrs(0); + applytextattributes(0); if (!(cc % zterm_columns)) fputs(" \010", shout); cleareol(); diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index f94bfce3c..07fac7144 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -2560,6 +2560,8 @@ printfmt(char *fmt, int n, int dopr, int doesc) } } if (dopr) { + treplaceattrs(0); + applytextattributes(0); if (!(cc % zterm_columns)) fputs(" \010", shout); if (tccan(TCCLEAREOL)) diff --git a/Test/D01prompt.ztst b/Test/D01prompt.ztst index a0abb7e1d..55861cca1 100644 --- a/Test/D01prompt.ztst +++ b/Test/D01prompt.ztst @@ -261,7 +261,7 @@ A1=${(%):-%s} A2=${(%):-%u} A3=${(%):-%s%u%s} - [[ $A3 = $A1$A2 && -n $A1 && -n $A2 ]] + [[ $A3 = $A1$A2 ]] 0:Attribute optimisation - preserve initial disabling of attribute but drop useless later one : ${(%):-%K{blue}} diff --git a/Test/X04zlehighlight.ztst b/Test/X04zlehighlight.ztst index 296635bf5..87a59fde5 100644 --- a/Test/X04zlehighlight.ztst +++ b/Test/X04zlehighlight.ztst @@ -40,7 +40,7 @@ # Fix e^Mexit - match ((?)\r(?)), if \2 == \3, then replace with \2 # otherwise replace with \1 stripped out of leading/trailing [[:space:]] REPLY=${REPLY//(#b)((?(#c0,1))$cm(?(#c0,1)))/${${${(M)match[2]:#${match[3]}}:+${match[2]}}:-${${match[1]##[[:space:]]##}%%[[:space:]]##}}} - [[ -n "$REPLY" ]] && print -r -- ${${REPLY%%[[:space:]]##}##[[:space:]]##} + [[ -n "$REPLY" ]] && print -r -- ${${REPLY%%${~cm}*}##[[:space:]]##} done } zpty_stop() {