Preserve line-endings in inline editing
When a file with Windows line endings was edited all the line ending characters were replaced by the Unix style line endings '\n'. This generated artificially large diffs as all lines had a changed line ending. To solve the issue this change automatically detects the line-ending type and preserves line-endings by setting an option parameter of the editor called "lineSeperator". Bug: issue 3345 Change-Id: If7e2ed3b3327c7734175f1d3e864deaae2401a8f
This commit is contained in:
@@ -558,7 +558,7 @@ public class EditScreen extends Screen {
|
||||
mode = ModeInfo.findMode(content.getContentType(), path);
|
||||
}
|
||||
}
|
||||
mv = MergeView.create(editor, Configuration.create()
|
||||
Configuration cfg = Configuration.create()
|
||||
.set("autoCloseBrackets", prefs.autoCloseBrackets())
|
||||
.set("cursorBlinkRate", prefs.cursorBlinkRate())
|
||||
.set("cursorHeight", 0.85)
|
||||
@@ -574,7 +574,13 @@ public class EditScreen extends Screen {
|
||||
.set("styleSelectedText", true)
|
||||
.set("tabSize", prefs.tabSize())
|
||||
.set("theme", prefs.theme().name().toLowerCase())
|
||||
.set("value", ""));
|
||||
.set("value", "");
|
||||
|
||||
if (editContent.contains("\r\n")) {
|
||||
cfg.set("lineSeparator", "\r\n");
|
||||
}
|
||||
|
||||
mv = MergeView.create(editor, cfg);
|
||||
|
||||
cmBase = mv.leftOriginal();
|
||||
cmBase.getWrapperElement().addClassName(style.base());
|
||||
|
||||
Reference in New Issue
Block a user