forked from Botanical/BotanJS
Proper REDO / UNDO function ( without cursor pos )
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
|
||||
INSERT.prototype.dispose = function()
|
||||
{
|
||||
this.__cursor.moveX( -1 );
|
||||
this.__rec( "", true );
|
||||
};
|
||||
|
||||
@@ -68,12 +69,6 @@
|
||||
var contentUndo = this.__contentUndo;
|
||||
var startPos = this.__startPosition;
|
||||
|
||||
if( insertLength < 0 )
|
||||
{
|
||||
startPos += insertLength;
|
||||
insertLength = 0;
|
||||
}
|
||||
|
||||
return function() {
|
||||
var contentRedo = feeder.content.substr( startPos, insertLength );
|
||||
feeder.content =
|
||||
@@ -128,8 +123,15 @@
|
||||
|
||||
var f = ContentPosition( feeder );
|
||||
|
||||
this.__contentUndo = feeder.content.substr( f, 1 ) + this.__contentUndo;
|
||||
this.__insertLength --;
|
||||
if( this.__insertLength <= 0 )
|
||||
{
|
||||
this.__contentUndo = feeder.content.substr( f, 1 ) + this.__contentUndo;
|
||||
this.__startPosition --;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.__insertLength --;
|
||||
}
|
||||
|
||||
feeder.content =
|
||||
feeder.content.substring( 0, f )
|
||||
@@ -140,7 +142,6 @@
|
||||
var f = ContentPosition( feeder );
|
||||
|
||||
this.__contentUndo += feeder.content.substr( f, 1 );
|
||||
this.__insertLength ++;
|
||||
|
||||
feeder.content =
|
||||
feeder.content.substring( 0, f )
|
||||
|
Reference in New Issue
Block a user