summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-05-12 19:58:04 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-05-12 19:58:04 +0000
commitfeb2df4b6345fd7494772b6b560a50a85eb93125 (patch)
tree5cd0b4cf73881faa442ea5b94d616ba14a86b411
parentd1abd3e7cf53fc271e9d7c5de4f84ad3e6be42c7 (diff)
downloadzsh-feb2df4b6345fd7494772b6b560a50a85eb93125.tar.gz
zsh-feb2df4b6345fd7494772b6b560a50a85eb93125.tar.xz
zsh-feb2df4b6345fd7494772b6b560a50a85eb93125.zip
26958: Fix reallocation problem in prompts
-rw-r--r--ChangeLog7
-rw-r--r--Src/prompt.c3
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a32a9e3c..ebafdae8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-12  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 26958: Src/prompt.c: Reallocation of prompt line didn't
+	fix the pointer to the start of the current line.
+
 2009-05-12  Peter Stephenson  <pws@csr.com>
 
 	* unposted: Functions/Prompts/prompt_bart_setup: fix a warning
@@ -11698,5 +11703,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4684 $
+* $Revision: 1.4685 $
 *****************************************************
diff --git a/Src/prompt.c b/Src/prompt.c
index 20e21e391..e56b70d0b 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -841,6 +841,7 @@ addbufspc(int need)
     if((bv->bp - bv->buf) + need > bv->bufspc) {
 	int bo = bv->bp - bv->buf;
 	int bo1 = bv->bp1 ? bv->bp1 - bv->buf : -1;
+	ptrdiff_t bufline_off = bv->bufline ? bv->bufline - bv->buf : -1;
 
 	if(need & 255)
 	    need = (need | 255) + 1;
@@ -848,6 +849,8 @@ addbufspc(int need)
 	bv->bp = bv->buf + bo;
 	if(bo1 != -1)
 	    bv->bp1 = bv->buf + bo1;
+	if (bufline_off != -1)
+	    bv->bufline = bv->buf + bufline_off;
     }
 }