Get data re text changes

Is it possible to get an array of changes made on the content since change generation point?

changeGeneration itself just returns an int and getHistory returns info the changes it needs to make to return to a previous undo point. I’d like something like the latter but re changes made since the a change generation point, not what needs to be undone to ‘undo’.

My use case is when I save content (say 2000 lines and I’ve just changed 3), I can just send an array of info re the changes made to those 3 lines (add, edit, delete). I can then stitch these into the file on the server. The result of sending info on the 3 lines vs sending 2000 lines of full content would be a huge time saver.

I’ve scanned through the manual but couldn’t found any info re this?

No such thing exists, but you could build something like it by listening to the change event and accumulating your own list of changes.

I did wonder if that was the only way, thanks for confirming. :smile:

For anyone else who needs to cover the same thing (getting content diffs at any given moment), I ended up using Could have written my own thing on change event as suggested, but for the sake of a couple of kb’s to have this lib available and not needing to manage an array of those changes, it saves all the hassle.

Gives instantaneous diff results, even on a 5000 line doc during my tests - you get a tuple back containing equal/insert/replace/delete events plus the lines from/to in each of the contents you’re comparing.

Highly recommended! :+1: