zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Pre-5.0.5 part 3: Heuristic for ZLE_RPROMPT_INDENT
Date: Sat, 08 Feb 2014 11:58:50 -0800	[thread overview]
Message-ID: <140208115850.ZM30584@torch.brasslantern.com> (raw)
In-Reply-To: <140207084619.ZM28881@torch.brasslantern.com>


} } 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;
 }


  reply	other threads:[~2014-02-08 19:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-02 21:58 Bart Schaefer
2014-02-07  9:45 ` Oliver Kiddle
2014-02-07 16:46   ` Bart Schaefer
2014-02-08 19:58     ` Bart Schaefer [this message]
2014-02-17 16:12       ` Mikael Magnusson
2014-02-17 18:34         ` Bart Schaefer
2014-12-08  0:46           ` Mikael Magnusson
2014-12-08  4:20             ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=140208115850.ZM30584@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).