www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - gap buffer in D2

reply BLS <windevguy hotmail.de> writes:
yep, mean it...

has somebody done it before...to me it seems to be not as trivial as it 
looks on the very first view. (speed matters)
Nov 04 2009
parent reply Spacen Jasset <spacenjasset yahoo.co.uk> writes:
BLS wrote:
 yep, mean it...
 
 has somebody done it before...to me it seems to be not as trivial as it 
 looks on the very first view. (speed matters)
 
 
Did one in C once for an editor (of course). Does that count? I might be able to find the code. It might not be pretty I can't remember.
Nov 04 2009
parent reply BLS <windevguy hotmail.de> writes:
On 05/11/2009 01:04, Spacen Jasset wrote:
 BLS wrote:
 yep, mean it...

 has somebody done it before...to me it seems to be not as trivial as
 it looks on the very first view. (speed matters)
Did one in C once for an editor (of course). Does that count? I might be able to find the code. It might not be pretty I can't remember.
YEP,would be nice to have a look. thanks! would be interesting to have a 2 gaps buffer for beyond-end insert (append)
Nov 04 2009
parent reply Spacen Jasset <spacenjasset yahoo.co.uk> writes:
BLS wrote:
 On 05/11/2009 01:04, Spacen Jasset wrote:
 BLS wrote:
 yep, mean it...

 has somebody done it before...to me it seems to be not as trivial as
 it looks on the very first view. (speed matters)
Did one in C once for an editor (of course). Does that count? I might be able to find the code. It might not be pretty I can't remember.
YEP,would be nice to have a look. thanks! would be interesting to have a 2 gaps buffer for beyond-end insert (append)
Perhaps, if you expect things to be inserted in the middle and at the end at the same time/alternately. I can't quite remember why I have this gap buffer. I do remember that I was going to have some sort of linked list of gap buffers for editing large files. The code should work. It's used in an old hex editor which works ok. http://dl.dropbox.com/u/731271/GapBuffer/GapBuffer.C and http://dl.dropbox.com/u/731271/GapBuffer/GapBuffer.h
Nov 06 2009
parent Spacen Jasset <spacenjasset yahoo.co.uk> writes:
Spacen Jasset wrote:
 BLS wrote:
 On 05/11/2009 01:04, Spacen Jasset wrote:
 BLS wrote:
 yep, mean it...

 has somebody done it before...to me it seems to be not as trivial as
 it looks on the very first view. (speed matters)
Did one in C once for an editor (of course). Does that count? I might be able to find the code. It might not be pretty I can't remember.
YEP,would be nice to have a look. thanks! would be interesting to have a 2 gaps buffer for beyond-end insert (append)
Perhaps, if you expect things to be inserted in the middle and at the end at the same time/alternately. I can't quite remember why I have this gap buffer. I do remember that I was going to have some sort of linked list of gap buffers for editing large files. The code should work. It's used in an old hex editor which works ok. http://dl.dropbox.com/u/731271/GapBuffer/GapBuffer.C and http://dl.dropbox.com/u/731271/GapBuffer/GapBuffer.h
By the way. it's isn't very quick at all. Some memcpy's would be required at least, rather than the for loops.
Nov 06 2009