zsh-workers
 help / color / mirror / code / Atom feed
From: Geoff Wing <gcw@zsh.org>
To: Zsh Hackers <zsh-workers@sunsite.dk>
Subject: PATCH: Status line fixes (Was: Various vared problems with screen refresh, etc.)
Date: Tue, 14 Aug 2001 21:55:37 +1000	[thread overview]
Message-ID: <20010814215537.A2327@primenet.com.au> (raw)
In-Reply-To: <20010814182828.A22134@primenet.com.au>; from gcw@zsh.org on Tue, Aug 14, 2001 at 08:28:44AM +0000

Geoff Wing <gcw@zsh.org> typed:
:Bart Schaefer <schaefer@brasslantern.com> typed:
::First problem:  Display refresh when a "minibuffer" command is used.
::Make sure the cursor is at the last line (do end-of-buffer-or-history).
::Invoke history-incremental-search-backward or -forward and look closely
::at the display.  In my case, I'm seeing some lines that should be off
::the top of the screen appearing above the `bck-i-search:' prompt.  I
::think a refresh computation somewhere is counting down N lines from the
::first line in the whole buffer, rather than down N lines from the first
::visible line.
:My problem.  I'll provide a patch for it.  It's duplicating a scroll
:around zle_refresh.c:436+ and snextline define.

Patch for three display things:
1) status line display was being mucked up
2) continuation marker "<...." for line extension off bottom right wasn't
   working properly
3) status line continuation marker "<....>" at end of first status line
   wasn't working properly

This slightly overloads "snextline" define in that one case should only
exist at the first usage however it's slightly tidier to do it this way
instead of making sure mostly duplicate code is synchronised.


Index: Src/Zle/zle_refresh.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v
retrieving revision 1.1.1.19
diff -u -r1.1.1.19 zle_refresh.c
--- Src/Zle/zle_refresh.c	2000/03/25 00:22:06	1.1.1.19
+++ Src/Zle/zle_refresh.c	2001/08/14 11:45:09
@@ -223,16 +223,25 @@
     if (ln != winh - 1)					\
 	ln++;						\
     else						\
-	if (tosln < 3) {				\
+	if (tosln > ln) {				\
+	    tosln--;					\
+	    if (nvln > 1) {				\
+		scrollwindow(0);			\
+		nvln--;					\
+	    } else					\
+		more_end = 1;				\
+	} else if (tosln > 2 && nvln > 1) {		\
+	    tosln--;					\
+	    if (tosln <= nvln) {			\
+		scrollwindow(0);			\
+		nvln--;					\
+	    } else {					\
+		scrollwindow(tosln);			\
+		more_end = 1;				\
+	    }						\
+	} else {					\
 	    more_status = 1;				\
 	    scrollwindow(tosln + 1);			\
-	} else if (tosln - 1 <= nvln) {			\
-	    scrollwindow(0);				\
-	    if (nvln)					\
-		nvln--, tosln--;			\
-	} else {					\
-	    tosln--;					\
-	    scrollwindow(tosln);			\
 	}						\
     if (!nbuf[ln])					\
 	nbuf[ln] = (char *)zalloc(winw + 2);		\
@@ -435,13 +444,6 @@
 
     if (statusline) {
 	tosln = ln + 1;
-        if (ln == winh - 1) {
-	    if (nvln > 0) {
-		scrollwindow(0);
-		nvln--;
-	    }
-	    tosln--;
-	}
 	nbuf[ln][winw + 1] = '\0';	/* text not wrapped */
 	snextline
 	t = (unsigned char *)statusline;
@@ -460,23 +462,43 @@
 		snextline
 	    }
 	}
+	if (s == sen)
+	    snextline
     }
+    *s = '\0';
 
 /* insert <.... at end of last line if there is more text past end of screen */
     if (more_end) {
 	if (!statusline)
 	    tosln = winh;
-	strncpy(nbuf[tosln - 1] + winw - 7, " <.... ", 7);
+	s = nbuf[tosln - 1];
+	sen = s + winw - 7;
+	for (; s < sen; s++) {
+	    if (*s == '\0') {
+		for (; s < sen; )
+		    *s++ = ' ';
+		break;
+	    }
+	}
+	strncpy(sen, " <.... ", 7);
 	nbuf[tosln - 1][winw] = nbuf[tosln - 1][winw + 1] = '\0';
     }
 
 /* insert <....> at end of first status line if status is too big */
     if (more_status) {
-	strncpy(nbuf[tosln] + winw - 8, " <....> ", 8);
+	s = nbuf[tosln];
+	sen = s + winw - 8;
+	for (; s < sen; s++) {
+	    if (*s == '\0') {
+		for (; s < sen; )
+		    *s++ = ' ';
+		break;
+	    }
+	}
+	strncpy(sen, " <....> ", 8);
 	nbuf[tosln][winw] = nbuf[tosln][winw + 1] = '\0';
     }
 
-    *s = '\0';
     nlnct = ln + 1;
     for (ln = nlnct; ln < winh; ln++)
 	zfree(nbuf[ln], winw + 2), nbuf[ln] = NULL;

-- 
Geoff Wing : <gcw@pobox.com>
Rxvt Stuff : <gcw@rxvt.org>
Zsh Stuff  : <gcw@zsh.org>


  reply	other threads:[~2001-08-14 11:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-14  7:30 Various vared problems with screen refresh, etc Bart Schaefer
2001-08-14  8:28 ` Geoff Wing
2001-08-14 11:55   ` Geoff Wing [this message]
2001-09-15 18:43 ` Bart Schaefer
2001-09-15 20:40   ` PATCH: ZLE doc xref to BAUD, fix doc build error Bart Schaefer
2001-09-15 23:21   ` Various vared problems with screen refresh, etc Peter Stephenson
2001-09-16  4:25     ` Bart Schaefer
2001-09-15 18:45 ` History and vared Bart Schaefer
2001-09-17 18:24   ` Wayne Davison

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=20010814215537.A2327@primenet.com.au \
    --to=gcw@zsh.org \
    --cc=zsh-workers@sunsite.dk \
    /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).