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 14975 invoked from network); 9 Jan 2023 20:41:58 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 9 Jan 2023 20:41:58 -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:From:Reply-To:Cc: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=qIbZiA6FA0VJ8WySBDSym2DaTEfqRIe0jtUPiKicBcA=; b=nXzetPxsRFy3eQdxUKNxKzSf2o LCUyzm7n7bkHcuSX/krTFzXz5v/fA2DpLTI2hdXLsexS6jstYY48QevoB+eIesgXSkvqAiroBQmj6 AenMHw/sJJCIjFv/teL4NB4+erQlWouZYeqmLDylTvsSgdPWsZJpbL56YiafUvSwjntLY/msX7nby En8MocoOwjRl72nlwe/W19HJEsZ2hHrAsSCBVtUMOrrolwAsC/MbRT4FeQNR68jTU6+P6aEMHyDIM n3/7yvnGaLMh0F4Kt6M/ScmHFI/cS5tafFU64a/depj+F7lRL+6Ko/8HuTNBGe32x3ITwg/1mgKSg eW9SxmPg==; Received: by zero.zsh.org with local id 1pEyxw-0001em-BC; Mon, 09 Jan 2023 20:41:56 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pEyxd-0001Ln-Td; Mon, 09 Jan 2023 20:41:38 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.95) (envelope-from ) id 1pEyxb-000Cn4-UY for zsh-workers@zsh.org; Mon, 09 Jan 2023 21:41:36 +0100 From: Oliver Kiddle To: Zsh workers Subject: PATCH: terminal attributes and singlelinezle MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <49168.1673296895.1@hydra> Date: Mon, 09 Jan 2023 21:41:35 +0100 Message-ID: <49169-1673296895.883502@5MWf.NP3f.G7lb> X-Seq: 51289 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: The tsetcap() function is used for setting terminal attributes from two places - prompt escapes and at the beginning of a fresh line when it is called to turn off first all attributes and then standout and underline. In addition to %B, %U etc it is also used for %E (clear to end-of-line) in a prompt. If the SINGLE_LINE_ZLE option is set, tsetcap() bails out early. Given that you can use %F, %K etc with SINGLE_LINE_ZLE along with all of zle_highlight and region_highlight this seems like a fairly pointless limitation. The manual entry for the option talks about ksh emulation but ksh emulation includes disabling PROMPT_PERCENT which achieves the same effect. I also don't see what is achieved with the belt-and-braces approach of explicitly turning off standout and underline after turning off all attributes. If tsetcap(TCALLATTRSOFF, 0) doesn't work, you'll have other problems besides. And for this particular case, users have the option of adding extra sequences to PROMPT_EOL_MARK. We could perhaps restore an if (isset(SINGLELINEZLE)) around this call to tsetcap()? Or some other condition? This patch drops the option check and the two superfluous termcap sequences. Oliver diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index 51090119f..6d75b0fda 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -1112,8 +1112,6 @@ zrefresh(void) #endif /* we probably should only have explicitly set attributes */ tsetcap(TCALLATTRSOFF, 0); - tsetcap(TCSTANDOUTEND, 0); - tsetcap(TCUNDERLINEEND, 0); txtcurrentattrs = txtpendingattrs = txtunknownattrs = 0; if (trashedzle && !clearflag) diff --git a/Src/prompt.c b/Src/prompt.c index fd83dee64..39fcf5eb7 100644 --- a/Src/prompt.c +++ b/Src/prompt.c @@ -1004,8 +1004,7 @@ stradd(char *d) mod_export void tsetcap(int cap, int flags) { - if (tccan(cap) && !isset(SINGLELINEZLE) && - !(termflags & (TERM_NOUP|TERM_BAD|TERM_UNKNOWN))) { + if (tccan(cap) && !(termflags & (TERM_NOUP|TERM_BAD|TERM_UNKNOWN))) { switch (flags) { case TSC_RAW: tputs(tcstr[cap], 1, putraw);