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 25082 invoked from network); 9 Jan 2023 22:04:25 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 9 Jan 2023 22:04:25 -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=DfLt6qIRfpU281mCe6pbTSxn2oBRRHZyb2ixrvBdEHs=; b=sRQyEGA9mm9qkBR6QmcV6FKBs5 F6XBN9H7XL9RDpObbLeMhkrjc7NoaSstSxpbUF0dfbBNjNfPfXOkcdAmK0LqoY2zQr1boKMuGGJVC R/Xz6bK+y64WieEjomJn6GQBTAaWpipX7NHoz1zc0biPZYbXQqQnaARCl9/Y/aCKN5d9dcf79ON6X Wbptc8cZOfRJ4DuLMGQjbtlI1uHYQdwMc6CVHmjpW4m3JfbZTjSw9Oi2MCPsf6AyF0C7USY0RDfe4 CpAJgOgAtFfy4GQWqIBZ7APC1HftP21l7b+o+DzJ293lbT3TFVXIGxllCesmkkx6/Z5J7BtZPAuMs gS8Zmupg==; Received: by zero.zsh.org with local id 1pF0Fk-00048H-Op; Mon, 09 Jan 2023 22:04:24 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pF0FT-0003oj-0T; Mon, 09 Jan 2023 22:04:07 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.95) (envelope-from ) id 1pF0FS-000Dap-Fw for zsh-workers@zsh.org; Mon, 09 Jan 2023 23:04:06 +0100 From: Oliver Kiddle To: Zsh workers Subject: PATCH: fix for control characters and singlelinezle MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <52253.1673301846.1@hydra> Date: Mon, 09 Jan 2023 23:04:06 +0100 Message-ID: <52254-1673301846.490897@ja-O.BWAu.6IyE> X-Seq: 51290 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 noticed some weird effects with control characters and the singlelinezle option. Every control character would appear as ^@ and change to ^? once the next character is typed (with the next character not being displayed). Also the cursor is getting positioned over the last character position of special characters that are rendered as multiple characters. I guess it's not an option that gets a lot of use. Oliver diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index 6d75b0fda..daa43336e 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -2429,6 +2429,8 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs) } all_attr = mixattrs(special_attr, base_attr); + if (t0 == tmpcs) + nvcs = vp - vbuf; if (tmpline[t0] == ZWC('\t')) { for (*vp++ = zr_sp; (vp - vbuf) & 7; ) *vp++ = zr_sp; @@ -2471,7 +2473,7 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs) && (unsigned)tmpline[t0] <= 0xffU #endif ) { - ZLE_INT_T t = tmpline[++t0]; + ZLE_INT_T t = tmpline[t0]; vp->chr = ZWC('^'); vp->atr = all_attr; @@ -2508,8 +2510,6 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs) vp++; } #endif - if (t0 == tmpcs) - nvcs = vp - vbuf - 1; } if (t0 == tmpcs) nvcs = vp - vbuf;