Bug fix for last line shifting

This commit is contained in:
斟酌 鵬兄 2016-04-16 19:07:13 +08:00
parent d7b2754ba1
commit 5d91d516aa
1 changed files with 17 additions and 7 deletions

View File

@ -15,10 +15,6 @@
var occurence = __import( "System.utils.Perf.CountSubstr" ); var occurence = __import( "System.utils.Perf.CountSubstr" );
var REPL_BEFORE = 0;
var REPL_OFFSET = 1;
var REPL_LENGTH = 2;
/** @type {Components.Vim.IAction} /** @type {Components.Vim.IAction}
* Cursor @param {Components.Vim.Cursor} * Cursor @param {Components.Vim.Cursor}
* e @param {Components.Vim.ActionEvent} * e @param {Components.Vim.ActionEvent}
@ -261,7 +257,15 @@
if( end < j ) break; if( end < j ) break;
var line = c.substring( 1 < i ? i : i - 1, c.indexOf( "\n", i ) ); var line = c.indexOf( "\n", i );
if( ~line )
{
line = c.substring( 1 < i ? i : i - 1, line );
}
else
{
line = c.substring( 1 < i ? i : i - 1 );
}
if( 1 < i ) if( 1 < i )
{ {
@ -291,7 +295,11 @@
if( !~"\t ".indexOf( line[ sj ] ) ) break; if( !~"\t ".indexOf( line[ sj ] ) ) break;
} }
} }
else if( startC != "\t" ) break; else if( startC == "\t" )
{
sj ++;
}
else break;
} }
indentedLine = line.substring( sj ); indentedLine = line.substring( sj );
@ -305,7 +313,9 @@
} }
var nPos = feeder.content.length; var nPos = feeder.content.length;
feeder.content += "\n" + c.substring( i ) + "\n"; feeder.content += "\n";
if( ~i ) feeder.content += c.substring( i ) + "\n";
feeder.pan(); feeder.pan();
cur.moveTo( nPos ); cur.moveTo( nPos );