MidnightCommander/mc — pull request #49 by pfalcon (2014-12-06 19:07:39+00:00)
Title: Updated fix for #1652: autodetect line breaks type in editor

This is rebased and updated branch https://github.com/MidnightCommander/mc/tree/1652_autodetect_lb , addressing bugreport http://www.midnight-commander.org/ticket/1652 .

It consists of rebasing to the latest codebase original patches (editor functionality by myself, editor options by Ilia Maslakov, line break detection unit tests by Slava Zanko), and additional changes to make linebreak type detection much more conservative and robust (plus some refactoring of unittests).

This patcheset adheres to following requirements:

1. By default, linebreak type autodetection is off, and editor behavior is fully as before (including binary-safety, etc.)
2. When autodetection is on, it is done in conservative manner: bigger sampling buffer size is used to increase confidence; a non-default linebreak type is chosen only if it there was no conflicts in detection; any suspicion that file is binary disables detection. If any of the above conditions are not met, file is loaded with default "as is" line break type (which is the original, binary-safe mode).