about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-01-08 15:07:02 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-01-08 15:07:02 +0000
commit4497b2b1b70bb1646bb4d62c9f5b410f7a6fe536 (patch)
treeca342afaef1abf67a5dd7b2c1fee37a02197d6c1 /Src/Zle
parent174143dd7c2fc1da1668a216028f0657088aa166 (diff)
downloadzsh-4497b2b1b70bb1646bb4d62c9f5b410f7a6fe536.tar.gz
zsh-4497b2b1b70bb1646bb4d62c9f5b410f7a6fe536.tar.xz
zsh-4497b2b1b70bb1646bb4d62c9f5b410f7a6fe536.zip
24371: bug refreshing large scrolling history entry
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_refresh.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index a705f67cf..cdda42287 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -797,7 +797,7 @@ zrefresh(void)
 		(int)ZR_strlen(nbuf[0]) + rpromptw < winw - 1;
     } else {
 /* insert >.... on first line if there is more text before start of screen */
-	memset(nbuf[0], ZWC(' '), lpromptw);
+	ZR_memset(nbuf[0], ZWC(' '), lpromptw);
 	t0 = winw - lpromptw;
 	t0 = t0 > 5 ? 5 : t0;
 	ZR_memcpy(nbuf[0] + lpromptw, ZWS(">...."), t0);
@@ -1133,6 +1133,15 @@ refreshline(int ln)
 	    if (!*ol) {
 		i = (col_cleareol >= 0) ? col_cleareol : nllen;
 		i -= vcs;
+		if (i < 0) {
+		    /*
+		     * This shouldn't be necessary, but it's better
+		     * than a crash if there's a bug somewhere else,
+		     * so report in debug mode.
+		     */
+		    DPUTS(1, "BUG: badly calculated old line width in refresh");
+		    i = 0;
+		}
 		zwrite(nl, i);
 		vcs += i;
 		if (col_cleareol >= 0)