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 19240 invoked from network); 11 Jan 2023 13:01:47 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 11 Jan 2023 13:01:47 -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=A043WT46cvo9RlUaWPr0fsvyenbMW/CUeON+lXDs174=; b=EUVaj9yRbZKwPYuvcQq97SESbH gVAvUppsCG+413EiQUMZF8eYmgFwXGCdGixcT12PnHxs0X0pvRlGyEc7i0p6DC8mXbMkJGR1ZKujD 2vrhZdrcp0I96e6jxVmNa+JaaDAU4xB16IdoLKaRGNUdO09wqECNqesI3K0lpsWtdYQ+awx3Y7sjB Dm3Nnd3cmMQSUG+qJy2WTYaEcQeL0aYQLWFpVtm3uxqiJBBI+a2cT8JSdDfRVpwwI3G8tlq1wub6r Taw7eAJGHDvE6rIB6DNXLByGjbn4gHJnWvKbbJ1JE4eGS29Mg6Ib6/6I76H4XnwKSd0PdiqGjIRH/ PAmVW9BQ==; Received: by zero.zsh.org with local id 1pFaji-000Ewf-Dd; Wed, 11 Jan 2023 13:01:46 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pFajN-000EeD-J0; Wed, 11 Jan 2023 13:01:25 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.95) (envelope-from ) id 1pFajN-0009zQ-2D for zsh-workers@zsh.org; Wed, 11 Jan 2023 14:01:25 +0100 In-reply-to: <92837-1673369733.527434@Np6E.5Ah8.qv5l> From: Oliver Kiddle References: <92837-1673369733.527434@Np6E.5Ah8.qv5l> To: Zsh workers Subject: Re: PATCH: fix updates to region_highlight, accounting for PREDISPLAY MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <38402.1673442085.1@hydra> Date: Wed, 11 Jan 2023 14:01:25 +0100 Message-ID: <38403-1673442085.060866@B6_J.KewG.L0mc> X-Seq: 51295 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: I wrote: > Or perhaps just make a special case for the end of PREDISPLAY? After thinking about it, this approach is probably logical. It is already the case that a region will only be extended at the end if the cursor is positioned there. In testing this, I also found an old bug where attributes could be messed up because they were saved to an int instead of a zattr. Oliver diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index 45a82dd5e..9ce91049c 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -580,7 +580,7 @@ struct zle_region; struct zle_region { struct zle_region *next; /* Entries of region_highlight, as needed */ - int atr; + zattr atr; int start; int end; int flags; @@ -799,7 +799,7 @@ spaceinline(int ct) if (rhp->start_meta - sub >= zlemetacs) { rhp->start_meta += ct; } - if (rhp->end_meta - sub >= zlemetacs) { + if (rhp->end_meta - sub >= zlemetacs && (!predisplaylen || zlecs)) { rhp->end_meta += ct; } } @@ -827,7 +827,7 @@ spaceinline(int ct) if (rhp->start - sub >= zlecs) { rhp->start += ct; } - if (rhp->end - sub >= zlecs) { + if (rhp->end - sub >= zlecs && (!predisplaylen || zlecs)) { rhp->end += ct; } }