Index: /FCKeditor/trunk/_samples/html/sample12.html
===================================================================
--- /FCKeditor/trunk/_samples/html/sample12.html	(revision 8)
+++ /FCKeditor/trunk/_samples/html/sample12.html	(revision 9)
@@ -31,6 +31,5 @@
 		FCKeditor - JavaScript - Sample 12</h1>
 	<div>
-		This sample shows the different ways to configure the [Enter] key
-		behavior on FCKeditor.
+		This sample shows the different ways to configure the [Enter] key behavior on FCKeditor.
 	</div>
 	<hr />
Index: /FCKeditor/trunk/editor/_source/classes/fckdomrange.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckdomrange.js	(revision 8)
+++ /FCKeditor/trunk/editor/_source/classes/fckdomrange.js	(revision 9)
@@ -23,5 +23,5 @@
 	
 	// Move the start boundary to the start of the block.
-	oTestRange.SetStart( oTestRange.StartBlock, 1 ) ;
+	oTestRange.SetStart( oTestRange.StartBlock || oTestRange.StartBlockLimit, 1 ) ;
 	
 	var bIsStartOfBlock = oTestRange.CheckIsEmpty() ;
@@ -43,5 +43,5 @@
 	
 	// Move the end boundary to the end of the block.
-	oTestRange.SetEnd( oTestRange.EndBlock, 2 ) ;
+	oTestRange.SetEnd( oTestRange.EndBlock || oTestRange.EndBlockLimit, 2 ) ;
 
 	var bIsEndOfBlock = oTestRange.CheckIsEmpty() ;
@@ -72,2 +72,46 @@
 }
 
+FCKDomRange.prototype.CreateBookmark = function()
+{
+	var oBookmark = 
+	{
+		StartId	: 'fck_dom_range_start_' + (new Date()).valueOf() + '_' + Math.floor(Math.random()*1000),
+		EndId	: 'fck_dom_range_end_' + (new Date()).valueOf() + '_' + Math.floor(Math.random()*1000)
+	} ;
+
+	var oDoc = this.Window.document ;
+	
+	var eSpan = oDoc.createElement( 'span' ) ;
+	eSpan.id = oBookmark.EndId ;
+	eSpan.innerHTML = '&nbsp;' ;	// For IE, it must have something inside, otherwise it may be removed during operations.
+
+	var oClone = this.Clone() ;
+	oClone.Collapse( false ) ;
+	oClone.InsertNode( eSpan ) ;
+	
+	eSpan = oDoc.createElement( 'span' ) ;
+	eSpan.id = oBookmark.StartId ;
+	eSpan.innerHTML = '&nbsp;' ;	// For IE, it must have something inside, otherwise it may be removed during operations.
+
+	var oClone = this.Clone() ;
+	oClone.Collapse( true ) ;
+	oClone.InsertNode( eSpan ) ;
+	
+	return oBookmark ;
+}
+
+FCKDomRange.prototype.MoveToBookmark = function( bookmark, preserveBookmark )
+{
+	var oDoc = this.Window.document ;
+	var eStartSpan	=  oDoc.getElementById( bookmark.StartId ) ;
+	var eEndSpan	=  oDoc.getElementById( bookmark.EndId ) ;
+
+	this.SetStart( eStartSpan, 4 ) ;
+	this.SetEnd( eEndSpan, 3 ) ;
+	
+	if ( !preserveBookmark )
+	{
+		FCKDomTools.RemoveNode( eStartSpan ) ;
+		FCKDomTools.RemoveNode( eEndSpan ) ;
+	}
+}
Index: /FCKeditor/trunk/editor/_source/classes/fckdomrange_gecko.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckdomrange_gecko.js	(revision 8)
+++ /FCKeditor/trunk/editor/_source/classes/fckdomrange_gecko.js	(revision 9)
@@ -235,47 +235,4 @@
 		else
 			throw( e ) ;
-	}
-}
-
-FCKDomRange.prototype.CreateBookmark = function()
-{
-	var oBookmark = 
-	{
-		StartId	: 'fck_dom_range_start_' + (new Date()).valueOf() + '_' + Math.floor(Math.random()*1000),
-		EndId	: 'fck_dom_range_end_' + (new Date()).valueOf() + '_' + Math.floor(Math.random()*1000)
-	} ;
-
-	var oDoc = this.Window.document ;
-	
-	var eSpan = oDoc.createElement( 'span' ) ;
-	eSpan.id = oBookmark.EndId ;
-
-	var oClone = this.Clone() ;
-	oClone.Collapse( false ) ;
-	oClone.InsertNode( eSpan ) ;
-	
-	eSpan = oDoc.createElement( 'span' ) ;
-	eSpan.id = oBookmark.StartId ;
-
-	var oClone = this.Clone() ;
-	oClone.Collapse( true ) ;
-	oClone.InsertNode( eSpan ) ;
-	
-	return oBookmark ;
-}
-
-FCKDomRange.prototype.MoveToBookmark = function( bookmark, preserveBookmark )
-{
-	var oDoc = this.Window.document ;
-	var eStartSpan	=  oDoc.getElementById( bookmark.StartId ) ;
-	var eEndSpan	=  oDoc.getElementById( bookmark.EndId ) ;
-
-	this.SetStart( eStartSpan, 4 ) ;
-	this.SetEnd( eEndSpan, 3 ) ;
-	
-	if ( !preserveBookmark )
-	{
-		FCKDomTools.RemoveNode( eStartSpan ) ;
-		FCKDomTools.RemoveNode( eEndSpan ) ;
 	}
 }
Index: /FCKeditor/trunk/editor/_source/classes/fckdomrange_ie.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckdomrange_ie.js	(revision 8)
+++ /FCKeditor/trunk/editor/_source/classes/fckdomrange_ie.js	(revision 9)
@@ -320,17 +320,17 @@
 }
 
-FCKDomRange.prototype.CreateBookmark = function()
-{
-	if ( this._Range )
-		return this._Range.getBookmark() ;
-}
-
-FCKDomRange.prototype.MoveToBookmark = function( bookmark )
-{
-	if ( !this._Range )
-		this._Range = this.Window.document.body.createTextRange() ;
-
-	this._Range.moveToBookmark( bookmark ) ;
-}
+//FCKDomRange.prototype.CreateBookmark = function()
+//{
+//	if ( this._Range )
+//		return this._Range.getBookmark() ;
+//}
+
+//FCKDomRange.prototype.MoveToBookmark = function( bookmark )
+//{
+//	if ( !this._Range )
+//		this._Range = this.Window.document.body.createTextRange() ;
+
+//	this._Range.moveToBookmark( bookmark ) ;
+//}
 
 FCKDomRange.prototype.Expand = function( unit )
@@ -371,5 +371,6 @@
 				
 				// Move the marker right before the resulting node.
-				oNode.parentNode.insertBefore( eMarker.parentNode.removeChild( eMarker ), oNode ) ;
+				if ( oNode != eMarker )
+					oNode.parentNode.insertBefore( eMarker.parentNode.removeChild( eMarker ), oNode ) ;
 
 				// Move the range start to the marker.
@@ -412,5 +413,6 @@
 				
 				// Move the marker right before the resulting node.
-				FCKDomTools.InsertAfterNode( oNode, eMarker.parentNode.removeChild( eMarker ) ) ;
+				if ( oNode != eMarker )
+					FCKDomTools.InsertAfterNode( oNode, eMarker.parentNode.removeChild( eMarker ) ) ;
 				
 				// Move the range before to the marker.
Index: /FCKeditor/trunk/editor/_source/classes/fckenterkey.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckenterkey.js	(revision 8)
+++ /FCKeditor/trunk/editor/_source/classes/fckenterkey.js	(revision 9)
@@ -188,11 +188,15 @@
 			// previous.appendChild( this.Window.document.createTextNode( ' ' ) ) ;
 			
-			// Set the current selection at the end of the previous element.
+			// Set the range to the end of the previous element and bookmark it.
 			range.SetStart( previous, 2 ) ;
 			range.Collapse( true ) ;
-			range.Select() ;
+			var oBookmark = range.CreateBookmark() ;
 
 			// Move the contents of the block to the previous element and delete it.
 			FCKDomTools.MoveChildren( currentBlock, previous ) ;
+
+			// Place the selection at the bookmark.
+			range.MoveToBookmark( oBookmark ) ;
+			range.Select() ;
 
 			bCustom = true ;
@@ -446,5 +450,5 @@
 		var bIsEndOfBlock	= oRange.CheckEndOfBlock() ;
 		
-		var sStartBlockTag = oRange.StartBlock.tagName.toUpperCase() ;
+		var sStartBlockTag = oRange.StartBlock ? oRange.StartBlock.tagName.toUpperCase() : '' ;
 		
 		if ( !this._HasShift && sStartBlockTag == 'LI' )
@@ -454,8 +458,12 @@
 		if ( bIsEndOfBlock && (/^H[1-6]$/).test( sStartBlockTag ) )
 		{
+			// Insert a bogus BR after the current paragraph.
 			FCKDomTools.InsertAfterNode( oRange.StartBlock, FCKTools.CreateBogusBR( this.Window.document ) ) ;
+
+			// The space is required by Gecko only to make the cursor blink.
 			FCKDomTools.InsertAfterNode( oRange.StartBlock, this.Window.document.createTextNode( '' ) ) ;
-			
-			oRange.SetStart( oRange.StartBlock.nextSibling, 1 ) ;
+
+			// IE and Gecko have different behaviors regarding the position.
+			oRange.SetStart( oRange.StartBlock.nextSibling, FCKBrowserInfo.IsIE ? 3 : 1 ) ;
 		}
 		else
@@ -469,5 +477,5 @@
 			oRange.InsertNode( eBr ) ;
 
-			if ( bIsEndOfBlock )
+			if ( bIsEndOfBlock && !FCKBrowserInfo.IsIE )
 			{
 				var eLastBr = FCKDomTools.GetLastChild( eBr.parentNode, 'BR' ) ;
@@ -478,5 +486,8 @@
 
 			if ( FCKBrowserInfo.IsIE )
+			{
 				oRange.SetStart( eBr, 4 ) ;
+				oRange.Collapse( true ) ;
+			}
 			else
 				oRange.SetStart( eBr.nextSibling, 1 ) ;
Index: /FCKeditor/trunk/editor/_source/internals/fcktools.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fcktools.js	(revision 8)
+++ /FCKeditor/trunk/editor/_source/internals/fcktools.js	(revision 9)
@@ -5,9 +5,16 @@
 <Author name="Frederico Caldeira Knabben" email="www.fckeditor.net" />
 */
+
 // Constant for the Gecko Bogus Node.
 var GECKO_BOGUS = '<br _moz_editor_bogus_node="TRUE">' ;
 
-
 var FCKTools = new Object() ;
+
+FCKTools.CreateBogusBR = function( targetDocument )
+{
+	var eBR = targetDocument.createElement( 'br' ) ;
+	eBR.setAttribute( '_moz_editor_bogus_node', 'TRUE' ) ;
+	return eBR ;
+}
 
 FCKTools.AppendStyleSheet = function( documentElement, cssFileUrlOrArray )
Index: /FCKeditor/trunk/editor/_source/internals/fcktools_gecko.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fcktools_gecko.js	(revision 8)
+++ /FCKeditor/trunk/editor/_source/internals/fcktools_gecko.js	(revision 9)
@@ -5,11 +5,4 @@
 <Author name="Frederico Caldeira Knabben" email="www.fckeditor.net" />
 */
-
-FCKTools.CreateBogusBR = function( targetDocument )
-{
-	var eBR = targetDocument.createElement( 'br' ) ;
-	eBR.setAttribute( '_moz_editor_bogus_node', 'TRUE' ) ;
-	return eBR ;
-}
 
 FCKTools.CancelEvent = function( e )
