about summary refs log tree commit diff
path: root/Src/init.c
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/init.c
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/init.c')
-rw-r--r--Src/init.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/Src/init.c b/Src/init.c
index 53c4fbd72..f5aae71f2 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -77,7 +77,7 @@ mod_export int tclen[TC_COUNT];
 /**/
 int tclines, tccolumns;
 /**/
-mod_export int hasam, hasxn;
+mod_export int hasam, hasxn, hasye;
 
 /* Value of the Co (max_colors) entry: may not be set */
 
@@ -699,6 +699,7 @@ init_term(void)
 	/* check whether terminal has automargin (wraparound) capability */
 	hasam = tgetflag("am");
 	hasxn = tgetflag("xn"); /* also check for newline wraparound glitch */
+	hasye = tgetflag("YE"); /* print in last column does carriage return */
 
 	tclines = tgetnum("li");
 	tccolumns = tgetnum("co");
@@ -748,6 +749,9 @@ init_term(void)
 	    tcstr[TCCLEARSCREEN] = ztrdup("\14");
 	    tclen[TCCLEARSCREEN] = 1;
 	}
+#if 0	/* This might work, but there may be more to it */
+	rprompt_indent = (hasye || !tccan(TCLEFT)) ? 1 : 0;
+#endif
     }
     return 1;
 }
@@ -999,6 +1003,15 @@ setupvals(void)
     setiparam("COLUMNS", zterm_columns);
     setiparam("LINES", zterm_lines);
 #endif
+    {
+	/* Import from environment, overrides init_term() */
+	struct value vbuf;
+	char *name = "ZLE_RPROMPT_INDENT";
+	if (getvalue(&vbuf, &name, 1) && !(vbuf.flags & PM_UNSET))
+	    rprompt_indent = getintvalue(&vbuf);
+	else
+	    rprompt_indent = 1;
+    }
 
 #ifdef HAVE_GETRLIMIT
     for (i = 0; i != RLIM_NLIMITS; i++) {