Hmm, I don't know if your fix fixes an as-of-yet-unknown bug (will check shortly), but it has nothing to do with the reported bug.
I agree on that. Anyway, thanks for the help.
Anyway, I 've fixed all breakpoint syncing issues when adding/removing lines in the editor (hopefully!).
Initially I wanted to say: "That's unfair!" because I was also still working on that one. Anyway, after looking at your solution I saw that we had at least the same idea, but your solution is still more clever than the one I was still implementing.
Anyway, I've done (nearly) all the tests that I had written down with all the special cases that can occure and guess what: Your code simply works. Just for a future reference here is what I had written down (for me) to test the breakpoints:
- (all tests usually for at least 3 lines of code)
- test for BP cases:
* only first line has a BP
* first+second line has a BP
* first+second+third line has a BP
* first+third line has a BP
- test for position cases:
* cursor within first line
* cursor within second line
* cursor within third line
- test for position of cursor within a line:
* position the cursor at the very beginning of the line
* position the cursor in the middle of a line
* position the cursor at the very end of the line
- test for paste-of-code cases:
* paste a single line of code
* paste two lines of code
* paste three lines of code
- test for del-of-code cases:
* del a single line of code
* del two lines of code
* del three lines of code
- test for insertion / deletion:
* insert: Press ENTER at the begining of a line
* insert: Press ENTER at the middle of a line
* insert: Press ENTER at the end of a line
* delete: mark a complete line (including "EOL"), press DEL
* delete: go to the end of a line, press DEL
- special cases:
* remove all characters of the file (CTRL+A;DEL)
* single line of code with not end of line marker
To sum up: WELL DONE!!!
With regards, Morten.