about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2013-12-18 23:45:20 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2013-12-18 23:45:20 -0800
commit9cacf4411f790f942f92f2c5afb42ffef4339dc7 (patch)
treebe8381e8a7e47447a080d6cf0886c448deba66f6 /Src/Zle
parent5f36aece2a3c9483d6e2835917953bcb9b70b431 (diff)
downloadzsh-9cacf4411f790f942f92f2c5afb42ffef4339dc7.tar.gz
zsh-9cacf4411f790f942f92f2c5afb42ffef4339dc7.tar.xz
zsh-9cacf4411f790f942f92f2c5afb42ffef4339dc7.zip
32157: fix extra line feed after prompt, and erased character in completion listing, when ZLE_RPROMPT_INDENT=0
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_refresh.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index debb9730d..fd5485770 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -977,7 +977,7 @@ zrefresh(void)
     int tmpalloced;		/* flag to free tmpline when finished	     */
     int remetafy;		/* flag that zle line is metafied	     */
     int txtchange;		/* attributes set after prompts              */
-    int rprompt_off = 1;	/* Offset of rprompt from right of screen    */
+    int rprompt_off;		/* Offset of rprompt from right of screen    */
     struct rparams rpms;
 #ifdef MULTIBYTE_SUPPORT
     int width;			/* width of wide character		     */
@@ -1579,16 +1579,12 @@ zrefresh(void)
 		!strchr(rpromptbuf, '\t');
 	    if (put_rpmpt)
 	    {
-		struct value vbuf;
-		char *name = "ZLE_RPROMPT_INDENT";
-		if (getvalue(&vbuf, &name, 1)) {
-		    rprompt_off = (int)getintvalue(&vbuf);
-		    /* sanity to avoid horrible things happening */
-		    if (rprompt_off < 0)
-			rprompt_off = 0;
-		}
-		put_rpmpt =
-		    (int)ZR_strlen(nbuf[0]) + rpromptw < winw - rprompt_off;
+	      rprompt_off = rprompt_indent;
+	      /* sanity to avoid horrible things happening */
+	      if (rprompt_off < 0)
+		rprompt_off = 0;
+	      put_rpmpt =
+		(int)ZR_strlen(nbuf[0]) + rpromptw < winw - rprompt_off;
 	    }
 	}
     } else {
@@ -2127,19 +2123,24 @@ moveto(int ln, int cl)
     const REFRESH_ELEMENT *rep;
 
     if (vcs == winw) {
-	vln++, vcs = 0;
-	if (!hasam) {
-	    zputc(&zr_cr);
-	    zputc(&zr_nl);
+	if (rprompt_indent == 0 && tccan(TCLEFT)) {
+	  tc_leftcurs(1);
+	  vcs--;
 	} 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;
+	    }
 	}
     }