Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Pre-5.0.5 part 3: Heuristic for ZLE_RPROMPT_INDENT



} } This effect seems to occur only on some terminals but may be version
} } specific because I get different results for the same terminal on
} } different systems.
} 
} More likely it's termcap/terminfo database version specific.  Can you
} compare the terminfo settings for two cases of the same terminal giving
} different behavior and report the difference?
} 
} If it's not terminfo, it may be some kind of emulation option that has
} a different setting in the Xdefaults etc.

I've just compared xterm on my old CentOS box (which does not show the
off-by-one effect) with xterm on my much newer Ubuntu box (where I *do*
see the effect).  Except for some keypad definitions, the terminfo are
identical.

However, on CentOS, my settings for class XTerm include ReverseWrap:true
whereas on Ubuntu I'm using the defaults.  Normally this would mean that
terminfo/cap should have the "bw" capability, but it's false in both
cases because of course it has to describe the default settings.

So perhaps the following patch ...?  (The change to zle_refresh.c is to
silence a spurious "may be used uninitialized" warning.)


diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index fd54857..2bedbc4 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;		/* Offset of rprompt from right of screen    */
+    int rprompt_off = 1;	/* Offset of rprompt from right of screen    */
     struct rparams rpms;
 #ifdef MULTIBYTE_SUPPORT
     int width;			/* width of wide character		     */
diff --git a/Src/init.c b/Src/init.c
index da2a1bf..fd12412 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, hasye;
+mod_export int hasam, hasbw, hasxn, hasye;
 
 /* Value of the Co (max_colors) entry: may not be set */
 
@@ -698,6 +698,7 @@ init_term(void)
 
 	/* check whether terminal has automargin (wraparound) capability */
 	hasam = tgetflag("am");
+	hasbw = tgetflag("bw");
 	hasxn = tgetflag("xn"); /* also check for newline wraparound glitch */
 	hasye = tgetflag("YE"); /* print in last column does carriage return */
 
@@ -750,7 +751,7 @@ init_term(void)
 	    tclen[TCCLEARSCREEN] = 1;
 	}
 	/* This might work, but there may be more to it */
-	rprompt_indent = (hasye || !tccan(TCLEFT)) ? 1 : 0;
+	rprompt_indent = ((hasam && !hasbw) || hasye || !tccan(TCLEFT));
     }
     return 1;
 }



Messages sorted by: Reverse Date, Date, Thread, Author