diff --git a/language/backgroundparser/parsejob.cpp b/language/backgroundparser/parsejob.cpp --- a/language/backgroundparser/parsejob.cpp +++ b/language/backgroundparser/parsejob.cpp @@ -79,6 +79,12 @@ { } + void normalizeLineEndings() { + // TODO: Optimization, could do this in one pass. + contents.contents.replace("\r\n", "\n"); + contents.contents.replace('\r', '\n'); + } + ReferencedTopDUContext duContext; IndexedString url; @@ -314,6 +320,8 @@ } d->contents.contents = file.readAll(); ///@todo Convert from local encoding to utf-8 if they don't match + // This is consistent with KTextEditor::Document::text() as used for already-open files. + d->normalizeLineEndings(); d->contents.modification = KDevelop::ModificationRevision(lastModified); file.close();