Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html (revision 3897)
+++ /CKEditor/trunk/CHANGES.html (revision 3898)
@@ -131,4 +131,5 @@
#3671 : Fixed body fixing should be applied to the real type under fake elements.
#3836 : Fixed remove list in enterMode=BR will merge sibling text to one line.
+ #3949 : Fixed enterKey within pre-formatted text introduce wrong line-break.
Index: /CKEditor/trunk/_source/plugins/selection/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/selection/plugin.js (revision 3897)
+++ /CKEditor/trunk/_source/plugins/selection/plugin.js (revision 3898)
@@ -492,5 +492,8 @@
testRange.setEndPoint( 'StartToStart', range );
- var distance = testRange.text.length;
+ // IE report line break as CRLF with range.text but
+ // only LF with textnode.nodeValue, normalize them to avoid
+ // breaking character counting logic below. (#3949)
+ var distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length;
while ( distance > 0 )
@@ -944,5 +947,5 @@
CKEDITOR.env.ie ?
// V2
- function()
+ function( forceExpand )
{
var collapsed = this.collapsed;
@@ -984,5 +987,5 @@
// Actually, we are using this flag just to avoid using this hack in all
// situations, but just on those needed.
- isStartMarkerAlone = !startNode.hasPrevious() || ( startNode.getPrevious().is && startNode.getPrevious().is( 'br' ) );
+ isStartMarkerAlone = forceExpand || !startNode.hasPrevious() || ( startNode.getPrevious().is && startNode.getPrevious().is( 'br' ) );
// Append a temporary before the selection.