Source editor corrupts text when undoing

Originator:tony
Number:rdar://11115732 Date Originated:25-Mar-2012 12:47 PM
Status:Duplicate/9461069 Resolved:
Product:Developer Tools Product Version:4.3.2 (4E2002)
Classification:Serious Bug Reproducible:Sometimes
 
25-Mar-2012 12:47 PM Tony Arnold:
Summary:

When using undo to revert changes to my source files, Xcode ocassionally corrupts the displayed text, or stops updating the source editor entirely.


Steps to Reproduce:

Make changes to your source file: in my case, I was editing code inside a method — I had deleted a block of code within the method, then typed out a new block of code further down. I realised I wanted to quickly check one of the things I had deleted, so I hit undo a few times (I know, I know!), expecting to view the code in question then redo the changes again.


Expected Results:

As above — the code is reverted in much the same manner as undoing changes in any text/source editor, then is able to be "redone" once I have finished looking at the changes.


Actual Results:

In one case, syntax highlighting went crazy — random strings of text were highlighted in different colours mid-word and the text view stopped updating entirely. Typing text had no effect at all, nor did selecting anything. In another case, the code itself was mangled. Methods were spread out across many lines (character by character), and other random corruption appeared to occur. The changes do not appear to be persisted to disk when this happens.


Regression:

Hard to say — I've seen it a number of times since Xcode 4's release. Often enough to complain about it on twitter, anyway.


Notes:

One item of interest — I often format my code using an external tool (uncrustify) while I'm working. Xcode usually responds to this without complaint, but it's possible that it's related.

Comments

I've also hit this several times. I found a reproducible test case about a year ago, as rdar://9553913.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!