Is there some algorithm(or its JavaScript implementation) to find the amount of shift in a word's position when the string containing the word was changed?
My project is an online editor based on CodeMirror where I need to re-position the cursor when new data has been added to the code using the MobWrite collaboration service.
Therefore, to set the cursor-position to the word that the current user was editing, I think I need to calculate the amount of shift in its position & add that to the original cursor-position.
Solution: Now, I'm trying to implement the method used by MobWrite.
Thank you all for your help.
The solution implemented by MobWrite is quite comprehensive & can be found here: http://neil.fraser.name/writing/cursor/ .
The solution to the problem I was actually trying to solve can be found here: Getting CodeMirror to follow a TextArea