Komodo / KomodoEdit

Komodo Edit is a fast and free multi-language code editor. Written in JS, Python, C++ and based on the Mozilla platform.
http://www.komodoide.com/komodo-edit
Other
2.16k stars 302 forks source link

Komodo Edit deletes text when saving a document #2285

Closed pturley0 closed 7 years ago

pturley0 commented 7 years ago

Short Summary

With a document of a specific form, and certain preference settings, Komodo Edit will delete text when saving the document.

Steps to Reproduce

  1. In Preferences -> File Saving, turn on "Clean trailing whitespace and EOL markers."
  2. Create a new document.
  3. Under Edit -> Current File Preferences..., make sure the encoding is UTF-8.
  4. Create a document with the following contents (also see attached):

    •••␌A
    
    •••ABCD
    
  5. In this document, the first and last lines are blank, as is the one in the middle. Each '•' is a space, and the 'FF' glyph is the form feed character (0x0c), which I originally encountered in a GPL license.
  6. Put your cursor on the last line.
  7. Save the document. It doesn't matter whether you put an extension on it.

Expected results

Komodo Edit saves my document exactly as shown.

Actual results

Komodo Edit chops the 'BCD' from the penultimate line before saving the file:

•••␌A

•••A

Platform Information

Komodo Edit Komodo Edit, version 10.2.0-alpha1, build 17637, platform macosx. Built on Wed Jan 25 09:00:15 2017. macOS Sierra Version 10.12.13

Additional Information

pturley0 commented 7 years ago

test-file.txt

pturley0 commented 7 years ago

I've attached the test file described by this issue.

pturley0 commented 7 years ago

movie.mov.zip

pturley0 commented 7 years ago

I've attached a movie that demonstrates the problem.

mitchell-as commented 7 years ago

Thank you for the report and for the test file. Reproduced.

mitchell-as commented 7 years ago

Note to self: this only happens when there are form feed characters in the buffer. Python thinks they are line separators, but Scintilla does not. koDocument.py's lines = text.splitlines(True) (around line 1446) needs to be changed to split lines by \r\n|\n, capture the line end, and construct lines appropriately.