First char INSERT issue due to prev commit

This commit is contained in:
斟酌 鵬兄 2017-01-25 15:42:05 +08:00
parent 42bbc3b240
commit d6a27ca87e
4 changed files with 50 additions and 6 deletions

View File

@ -61,6 +61,7 @@
this.__msg = "";
this.__rec( "", true );
this.__cursor.moveX( -1, false, false, true );
this.__cursor.fixTab();
};
INSERT.prototype.__rec = function( c, newRec )
@ -129,14 +130,16 @@
this.__contentUndo = feeder.content.substr( f, 1 ) + this.__contentUndo;
}
cur.moveX(
feeder.content[f] == "\t" ? -feeder.firstBuffer.tabWidth : -1
, true, true, true );
feeder.content =
feeder.content.substring( 0, f )
+ feeder.content.substring( f + 1 );
feeder.pan();
cur.moveX( -1, true, true );
if( 0 < this.__insertLen ) this.__insertLen --;
this.__punch --;
}

View File

@ -259,13 +259,20 @@
{
case SHIFT + A: // Append at the line end
ccur.lineEnd();
ccur.moveX( 1, true, true, true );
ccur.moveX( 1, false, true, true );
ccur.openAction( "INSERT", e );
break;
case I: // Insert
ccur.moveX( -1 );
case A: // Append
if( 0 < ccur.X )
{
ccur.moveX( -1, true );
ccur.moveX( 1, true, true, true );
}
ccur.openAction( "INSERT", e );
break;
case A: // Append
ccur.fixTab();
ccur.moveX( 1, false, true, true );
ccur.openAction( "INSERT", e );
break;
case SHIFT + I: // Append at line start

View File

@ -204,8 +204,33 @@
}
// Hacky tab compensations
if( !skipTab )
if( skipTab )
{
// Handles INSERT on first tab char
if( penetrate && 0 < d )
{
if( ( content.length - 1 ) <= x )
{
this.moveY( 1 );
this.X = 0;
this.updatePosition();
return;
}
}
}
else
{
// Handles INSERT on first tab char
if( penetrate )
{
if( line.content[0] == "\t" && x < tabStep )
{
this.moveY( -1 );
this.lineEnd( phantomSpace );
return;
}
}
var s = this.aX;
var a = rline[ s + d ];
var e = s;
@ -283,6 +308,13 @@
};
// fix the tab position
Cursor.prototype.fixTab = function()
{
this.moveX( 1, false, true );
this.moveX( -1 );
};
Cursor.prototype.lineStart = function( atWord )
{
if( atWord )

View File

@ -23,6 +23,8 @@ Components.Vim.Cursor.lineEnd;
/** @type Function */
Components.Vim.Cursor.updatePosition;
/** @type Function */
Components.Vim.Cursor.fixTab;
/** @type Function */
Components.Vim.Cursor.openAction;
/** @type Function */
Components.Vim.Cursor.openRunAction;