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

PATCH: Status line fixes (Was: Various vared problems with screen refresh, etc.)



Geoff Wing <gcw@xxxxxxx> typed:
:Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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@xxxxxxxxx>
Rxvt Stuff : <gcw@xxxxxxxx>
Zsh Stuff  : <gcw@xxxxxxx>



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