zsh-workers
 help / color / mirror / code / Atom feed
From: Patrick Oscity <patrick.oscity@gmail.com>
To: zsh-workers@zsh.org
Subject: Bug report
Date: Sat, 14 Dec 2013 19:44:49 +0100	[thread overview]
Message-ID: <9CB4226B-47EE-44FA-8F8F-01DF4CB5154D@gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 920 bytes --]

Dear zsh team,

I think I might have found a bug in zsh. Here is my bug report:

Steps to reproduce

	* add a simple RPROMPT to ~/.zshrc, e.g. RPROMPT='X'
	* optionally set PROMPT='$ ' to avoid side-effects of escape
	  sequences like color codes etc.

Actual outcome

	* the right prompt is not right aligned, it is in fact shifted to the
	  left by one character
	* this means that there is one character of space wasted
	* it is also optically disturbing, e.g. when using tmux and the
	  right prompt does not align with tmux's status bar

Expected outcome

	* the right prompt should be right aligned, using the full
	  available width of the terminal

Attached is a diff for zle_refresh.c that fixes the issue for me, although I now have to compile zsh myself. It would however be great to see this corrected in an official release of zsh. Thanks for your consideration!

Best,
Patrick


[-- Attachment #1.2: zle_refresh.c.diff --]
[-- Type: application/octet-stream, Size: 852 bytes --]

diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 17b78ce..f136178 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -1576,7 +1576,7 @@ zrefresh(void)
 	else
 	    put_rpmpt = rprompth == 1 && rpromptbuf[0] &&
 		!strchr(rpromptbuf, '\t') &&
-		(int)ZR_strlen(nbuf[0]) + rpromptw < winw - 1;
+		(int)ZR_strlen(nbuf[0]) + rpromptw < winw;
     } else {
 /* insert >.... on first line if there is more text before start of screen */
 	ZR_memset(nbuf[0], zr_sp, lpromptw);
@@ -1631,9 +1631,9 @@ zrefresh(void)
 	if (put_rpmpt && !iln && !oput_rpmpt) {
 	    int attrchange;
 
-	    moveto(0, winw - 1 - rpromptw);
+	    moveto(0, winw - rpromptw);
 	    zputs(rpromptbuf, shout);
-	    vcs = winw - 1;
+	    vcs = winw;
 	/* reset character attributes to that set by the main prompt */
 	    txtchange = pmpt_attr;
 	    /*

[-- Attachment #1.3: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 842 bytes --]

             reply	other threads:[~2013-12-14 18:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-14 18:44 Patrick Oscity [this message]
2013-12-14 19:08 ` Bart Schaefer
2013-12-14 20:43   ` Peter Stephenson
2013-12-15  1:15     ` Bart Schaefer
2013-12-15 13:30       ` Peter Stephenson
2013-12-15 17:10         ` Bart Schaefer
2013-12-15  1:08   ` Patrick Oscity
2013-12-15 11:01   ` Patrick Oscity
  -- strict thread matches above, loose matches on Subject: below --
2021-03-01  9:43 BUG REPORT ZheNing Hu
2021-03-01 15:27 ` Daniel Shahaf
2021-03-01 17:32 ` Bart Schaefer
2021-03-05  7:51   ` ZheNing Hu
2019-09-19 11:16 Bug report Vladimir Deyter
2019-09-19 14:53 ` Mikael Magnusson
2019-09-19 15:57   ` Daniel Shahaf
2014-12-26 16:53 mvxxc
2014-12-27  2:35 ` Bart Schaefer
2014-09-17  0:26 bug report Mica Chimera
2014-09-17  1:08 ` Frank Terbeck
2014-06-05 17:05 robin terrep-drangiug
2014-06-05 20:48 ` Bart Schaefer
2013-12-17 10:59 Bug report Patrick Oscity
2013-12-17 11:27 ` Peter Stephenson
2013-12-17 17:11 ` Bart Schaefer
2013-12-17 17:56   ` Bart Schaefer
2013-08-04 12:16 Bug Report Yuusuke Yoshimoto
2013-08-04 17:58 ` Peter Stephenson
1996-05-22  0:07 Bug report Felix von Leitner
1996-05-15  7:48 Martin Birgmeier
1996-05-10  8:30 Martin Birgmeier
1995-08-24 11:23 Bug Report Carsten Friedrich

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=9CB4226B-47EE-44FA-8F8F-01DF4CB5154D@gmail.com \
    --to=patrick.oscity@gmail.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).