Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
- X-seq: zsh-workers 44354
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Incorrect cursor position when ZLE_RPROMPT_INDENT=0 (with a fix)
- Date: Thu, 23 May 2019 07:48:33 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Q7WF/SZ7e9eS317U2ezSCxlV8qezwZ3GwW34w8Tor2s=; b=NWbx3avMTm3xb2EbJ60pRBvXRjQ/DjYwE3+wpaR4TljWjXy5LBRFby3p2zJyYlPn9x 8gwGl7IGL3oVdlcMj34DrVL3dX/Ce29yGXINxW04hfg4kZwzfnAO6Zs9kxtWjowILjSs 5IL7LunuwTIycCLSo+5h82ZBYi7qbsu4K5BmrDqCzIBlVxc7y8yJqLOpoeHz2iheCv8l dwkfsr4komL330ORdqn0IXYWw87GJJRZGCEP2FpRznksh9HcUFwb1aBh4d8QBuKkj5lO A3TseMVCKoIkliEhdjLgUieCjkXhNRJ61VWozmBgg4JGu4keRftFnmkp42ngsuusBZnQ esSg==
- In-reply-to: <CAN=4vMpeG8sA3ReySo+8D3GP8=AT1gzNDgNHRZ8gDgVqy4OLNA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAN=4vMpx_B5TRNQzDAvBoTFszoKea2=uQr5xjd0vZVH6py+oVA@mail.gmail.com> <CAH+w=7bYdLornMBJmjE_RHgiRcywT05FXkOQdSapZHkdT30X0A@mail.gmail.com> <CAN=4vMozz41wH3=ZOoe=tAx70bXnD1ieZFScY7Zauby-33UcXw@mail.gmail.com> <CAN=4vMpWA+2zeRjthq4aeXyb7AAc40BpfEz8O0Uaj23a1O_F6Q@mail.gmail.com> <CAN=4vMqaGT+baaxJsGS1TC9Y9EER3_sRiQn-AM2LkQ=cVp=1Dw@mail.gmail.com> <CAH+w=7buWyujVw-PqWuB40ywQ5BrePrTYWdkkB1Q6RSwuVeG8A@mail.gmail.com> <CAN=4vMr46PsxS-+gDSBU=mGeGMLtWsRxTp9wMAB87qL12serNQ@mail.gmail.com> <68081d8c-1aa6-203b-eb6c-e2d048de1340@ibr.cs.tu-bs.de> <CAN=4vMo9oZ19n5kwNiNDjSHQAnNJHXRBPSfZstN7QOvXgN3WrQ@mail.gmail.com> <CAKiz1a8wkSkCz6snNrQRdS3npNkMdC-yUgL7SKnKwHL_RZVSdg@mail.gmail.com> <CAN=4vMo9uK1BPqwAF=i7pEbOVuhhSWxVXi75Wb-pMjo9rvkRtQ@mail.gmail.com> <CAKiz1a8ZKX2JDwRsAEgHq-W9w4_A-8J6as57p7aa=jjR+tmgzA@mail.gmail.com> <CAN=4vMrWnwvRHKu+9QGaXK48odyFwn8ORQiJzkB+NBbjOOxiOw@mail.gmail.com> <CAKiz1a-nOkAe42JoxFRgMJ+LXZ3fgMxqgwNZOW+2Y45oqzu8hA@mail.gmail.com> <CAN=4vMpeG8sA3ReySo+8D3GP8=AT1gzNDgNHRZ8gDgVqy4OLNA@mail.gmail.com>
Is there anything else I need to do to move this forward? The patch works on all terminals I and others have tried (11 in total; some with multiple versions and/or configurations). The code no longer special-cases ZLE_RPROMPT_INDENT=0, which is nice. There is branch for ZLE_RPROMPT_INDENT=0 but it's just an optimization to avoid an unnecessary zputc(&zr_cr) call when it's known to have no effect. So I think the logic is simpler now.
Roman.
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 1f293845f..85e55e0d4 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -1678,7 +1678,12 @@ zrefresh(void)
moveto(0, winw - rprompt_off - rpromptw);
zputs(rpromptbuf, shout);
- vcs = winw - rprompt_off;
+ if (rprompt_off) {
+ vcs = winw - rprompt_off;
+ } else {
+ zputc(&zr_cr);
+ vcs = 0;
+ }
/* reset character attributes to that set by the main prompt */
txtchange = pmpt_attr;
/*
@@ -2159,25 +2164,20 @@ moveto(int ln, int cl)
const REFRESH_ELEMENT *rep;
if (vcs == winw) {
- if (rprompt_indent == 0 && tccan(TCLEFT)) {
- tc_leftcurs(1);
- vcs--;
- } else {
- vln++, vcs = 0;
- if (!hasam) {
- zputc(&zr_cr);
- zputc(&zr_nl);
- } else {
- if ((vln < nlnct) && nbuf[vln] && nbuf[vln]->chr)
- rep = nbuf[vln];
- else
- rep = &zr_sp;
- zputc(rep);
- zputc(&zr_cr);
- if ((vln < olnct) && obuf[vln] && obuf[vln]->chr)
- *obuf[vln] = *rep;
- }
- }
+ vln++, vcs = 0;
+ if (!hasam) {
+ zputc(&zr_cr);
+ zputc(&zr_nl);
+ } else {
+ if ((vln < nlnct) && nbuf[vln] && nbuf[vln]->chr)
+ rep = nbuf[vln];
+ else
+ rep = &zr_sp;
+ zputc(rep);
+ zputc(&zr_cr);
+ if ((vln < olnct) && obuf[vln] && obuf[vln]->chr)
+ *obuf[vln] = *rep;
+ }
}
if (ln == vln && cl == vcs)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author