From d09fbd451f492ab0df5c45f8205172b1035ce210 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 23 Nov 2007 23:54:25 +0000 Subject: Ok, that was a strange bug... --- src/fstring.h | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/fstring.h b/src/fstring.h index 8b512e2..c1b377c 100644 --- a/src/fstring.h +++ b/src/fstring.h @@ -253,6 +253,39 @@ namespace Bu appendChunk( p3 ); } } + /* + void insert( long nPos, const MyType &str ) + { + if( nLen <= 0 ) + return; + flatten(); + if( nPos <= 0 ) + { + prepend( pData, nLen ); + } + else if( nPos >= nLength ) + { + append( pData, nLen ); + } + else + { + Chunk *p1 = newChunk( nPos ); + Chunk *p2 = newChunk( nLen ); + Chunk *p3 = newChunk( nLength-nPos ); + cpy( p1->pData, pFirst->pData, nPos ); + cpy( p2->pData, pData, nLen ); + cpy( p3->pData, pFirst->pData+nPos, nLength-nPos ); + clear(); + appendChunk( p1 ); + appendChunk( p2 ); + appendChunk( p3 ); + } + }*/ + + void insert( long nPos, const chr *pData ) + { + insert( nPos, pData, strlen( pData ) ); + } void remove( long nPos, long nLen ) { @@ -261,7 +294,7 @@ namespace Bu if( nLen >= nLength-nPos ) nLen = nLength-nPos-1; flatten(); - cpy( pFirst->pData+nPos, pFirst->pData+nPos+nLen, nLen+1 ); + cpy( pFirst->pData+nPos, pFirst->pData+nPos+nLen, nLength-nPos+1 ); nLength -= nPos; } -- cgit v1.2.3