If the text on a line exceeds the width of the text view and causes a line break the syntax highlighting fails as it doesn’t seem to account for line breaks and instead continues across.
It is difficult to notice at first as it seems your text is just continuing along the top but you are in fact on a new line. This causes it to look like text has been duplicated.
Here is an example: http://cl.ly/BNUM