Index: /FCKeditor/trunk/editor/_source/classes/fckdomrangeiterator.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckdomrangeiterator.js	(revision 825)
+++ /FCKeditor/trunk/editor/_source/classes/fckdomrangeiterator.js	(revision 826)
@@ -37,5 +37,5 @@
 	 */
 	this.ForceBrBreak = false ;
-	
+
 	/**
 	 * Guarantees that the iterator will always return "real" block elements.
@@ -64,11 +64,11 @@
 		// The block element to be returned.
 		var block ;
-		
+
 		// The range object used to identify the paragraph contents.
 		var range ;
-		
+
 		// Indicated that the current element in the loop is the last one.
 		var isLast ;
-		
+
 		// Instructs to cleanup remaining BRs.
 		var removePreviousBr ;
@@ -161,5 +161,5 @@
 			}
 
-			// The last node has been found.		
+			// The last node has been found.
 			isLast = ( currentNode == lastNode ) ;
 
@@ -178,4 +178,5 @@
 
 					currentNode = parentNode ;
+					isLast = ( currentNode == lastNode ) ;
 					continueFromSibling = true ;
 				}
@@ -230,7 +231,7 @@
 				// Insert the fixed block into the DOM.
 				range.InsertNode( block ) ;
-				
+
 				removePreviousBr = true ;
-				removeLastBr = true ;				
+				removeLastBr = true ;
 			}
 			else if ( block.nodeName.toLowerCase() != 'li' )
@@ -251,5 +252,5 @@
 					// right position for our intents.
 					var splitInfo = range.SplitBlock() ;
-					
+
 					removePreviousBr = !splitInfo.WasStartOfBlock ;
 					removeLastBr = !splitInfo.WasEndOfBlock ;
@@ -265,5 +266,5 @@
 				// the current range, which could be an <li> child (nested
 				// lists) or the next sibling <li>.
-				
+
 				this._NextNode = FCKDomTools.GetNextSourceNode( range.EndNode, true ) ;
 				return block ;
@@ -277,5 +278,5 @@
 				previousSibling.parentNode.removeChild( previousSibling ) ;
 		}
-		
+
 		if ( removeLastBr )
 		{
@@ -284,5 +285,5 @@
 				block.removeChild( lastChild ) ;
 		}
-		
+
 		// Get a reference for the next element. This is important because the
 		// above block can be removed or changed, so we can rely on it for the
