cessen / ropey

A utf8 text rope for manipulating and editing large texts.
MIT License
1.04k stars 46 forks source link

Question about data sharing of rope clones #37

Closed eemed closed 3 years ago

eemed commented 3 years ago

I read ropeys design documentation but still can't quite get it. When cloning ropes the actual content is shared between them. If we then continue to insert text in one of the clones the other doesn't change. But we are tracking information about the text in the internal nodes so this means that atleast all of the internal nodes from root to the insert position must be changed according to the edit. So are we actually cloning (or duplicating) all of the internal nodes from root to the insert position in this case? What is actually cloned in this case?

Plisp commented 3 years ago

That's correct. It's called path copying and is done by Arc::make_mut