https://bugs.kde.org/show_bug.cgi?id=378827

Francis Herne <m...@flherne.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|https://commits.kde.org/kde |https://commits.kde.org/kde
                   |v-python/6043407c4ee2e1b3ee |vplatform/396dda6a43402cade
                   |fac8e1f8c96a651b92a14e      |fbcffa4473d62d34de14175
         Resolution|---                         |FIXED
             Status|REOPENED                    |RESOLVED

--- Comment #13 from Francis Herne <m...@flherne.uk> ---
Git commit 396dda6a43402cadefbcffa4473d62d34de14175 by Francis Herne.
Committed on 26/07/2017 at 19:09.
Pushed by flherne into branch '5.1'.

Normalize line endings when creating ParseJob from background file.

When the file being parsed is open in the editor, `ParseJob::readContents()`
 uses `KTextEditor::Document::text()` to read the contents.
At some point within KTextEditor, the line endings are normalized - even if
 the document uses \r or \r\n, the returned content is separated by \n only.

Otherwise, the contents are read directly from the file. Until this patch,
 the line endings aren't normalized in this case; the ParseJob contents
 differ depending on whether the file is open in the editor.

Several places in kdev-python (and, at a glance, other language plugins)
 assume that lines can be separated by, and end with, \n. Old-style Macintosh
 endings (\r) break this assumption, in the worst case causing a crash.

Using a regex in each instance would be a pain, and one code path normalizes
 line endings already, so I think the best option is to do so for background
 files also.

Differential Revision: https://phabricator.kde.org/D5707

M  +4    -0    language/backgroundparser/parsejob.cpp
M  +15   -0    util/kdevstringhandler.cpp
M  +5    -0    util/kdevstringhandler.h
M  +29   -1    util/tests/test_stringhandler.cpp
M  +3    -0    util/tests/test_stringhandler.h

https://commits.kde.org/kdevplatform/396dda6a43402cadefbcffa4473d62d34de14175

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to