Index: /FCKeditor/trunk/editor/_source/internals/fckundo_gecko.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckundo_gecko.js	(revision 396)
+++ /FCKeditor/trunk/editor/_source/internals/fckundo_gecko.js	(revision 397)
@@ -36,10 +36,22 @@
 		return ;
 
+	// Get the bookmarked HTML.
+	var sHtml = FCK.EditorDocument.body.innerHTML ;
+
 	// Shrink the array to the current level.
 	FCKUndo.SavedData = FCKUndo.SavedData.slice( 0, FCKUndo.CurrentIndex + 1 ) ;
 
 	// Cancel operation if the new step is identical to the previous one.
-	if ( FCKUndo.CurrentIndex >= 0 && FCK.EditorDocument.body.innerHTML == FCKUndo.SavedData[ FCKUndo.CurrentIndex ][0] )
+	if ( FCKUndo.CurrentIndex > 0 && sHtml == FCKUndo.SavedData[ FCKUndo.CurrentIndex ][0] )
 		return ;
+	// Save the selection and caret position in the first undo level for the first change.
+	else if (FCKUndo.CurrentIndex == 0 && sHtml == FCKUndo.SavedData[0][0])
+	{
+		var range = new FCKDomRange(FCK.EditorWindow);
+		range.MoveToSelection();
+		var bookmark = range.CreateBookmark2();
+		FCKUndo.SavedData[0][1] = bookmark;
+		return;
+	}
 
 	// If we reach the Maximun number of undo levels, we must remove the first
@@ -54,7 +66,4 @@
 	range.MoveToSelection();
 	var bookmark = range.CreateBookmark2();
-
-	// Get the bookmarked HTML.
-	var sHtml = FCK.EditorDocument.body.innerHTML ;
 
 	// Save the new level in front of the actual position.
