﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1359	IE Enter mode + obtrusive bookmarks	Scott McNaught		"When the enter key is pressed in IE, and obtrusive bookmark is created when oRange.Select() is called from FCKEnterKey.prototype._ExecuteEnterBr.

This temporarilly creates a space which is selected, then cleared. This distorts rendering when enter is pressed.
I find this particularly distracting when editing large documents on slow computers which take a while to process the enter behaviour.

To replicate this, type a single character into the editor, and press the left arrow (moving to the start of the paragraph). Hold down shift + enter until such time as you see a highlighted space + the character moving 1 char to the right then back again.

I tried setting up something similar to this in fckdomrange_ie.js:

FCKDomRange.prototype.Select = function( bUnobtrusive )
{
	if ( this._Range )
	{
		if( bUnobtrusive )
		{
			this.MoveToBookmark2( this.CreateBookmark2( true ) ) ;
		}
		else
		{
			this.SelectBookmark( this.CreateBookmark( true ) ) ;
		}
	}
}

Then calling oRange.Select(true).  I realise this changes the method signature of Select() from ie / gecko, but this was more just for testing purposes. This worked most of the time, except for:

- There appears to be an occasional implementation issue with SelectBookmark2() which throws an error
- Sometimes the <br /> is created and the cursor is placed after the <br /> node, but the cursor renders on the previous line.

Another fix I found is that oRange.Select generally does not always need to be called for IE from this function. I am unsure, however, if this fixes some edge-cases eg - the cursor occasionally stops blinking, or the cursor shows on the previous line. If there are edge cases like this, perhaps a check should be made, and only call oRange.Select() for IE when absolutely necessary.

I'm quite sure the code which does all this is in FCKDomRange.prototype.SelectBookmark:

		dummySpan = this.Window.document.createElement( 'span' ) ;
		dummySpan.innerHTML = '&nbsp;' ;
		eStartMarker.parentNode.insertBefore( dummySpan, eStartMarker ) ;
		
		if ( bIsStartMakerAlone )
		{
			// To expand empty blocks or line spaces after <br>, we need
			// instead to have a &nbsp;, which will be later deleted using the
			// selection.
			eStartMarker.parentNode.insertBefore( this.Window.document.createTextNode( '\u00a0' ), eStartMarker ) ;
		}



And selected and removed a few lines later with:

		if ( bIsStartMakerAlone )
		{
			// Move the selection start to include the temporary &nbsp;.
			oIERange.moveStart( 'character', -1 ) ;
			
			oIERange.select() ;

			// Remove our temporary stuff.
			this.Window.document.selection.clear() ;
		}
		else
			oIERange.select() ;

		FCKDomTools.RemoveNode( dummySpan ) ;

"	Bug	closed	Normal	FCKeditor 2.5	UI : Enter Key	SVN (FCKeditor) - Retired	fixed		
