forked from Botanical/BotanJS
G / gg commands
This commit is contained in:
parent
e0c50f1bff
commit
f227c7e16b
@ -168,29 +168,45 @@
|
||||
else if( this.feeder.moreAt < Y )
|
||||
{
|
||||
var feeder = this.feeder;
|
||||
var lastLine = feeder.lastBuffer.lineNum;
|
||||
var lineShift = Y - feeder.moreAt;
|
||||
|
||||
var i = 0;
|
||||
while( !feeder.EOF )
|
||||
{
|
||||
feeder.pan( undefined, lineShift + i );
|
||||
|
||||
// if it turns out to be the same line
|
||||
// before after panning
|
||||
// we keep scrolling it ( panning )
|
||||
// until the entire line cosumes the screen
|
||||
if( feeder.lastBuffer.lineNum == lastLine )
|
||||
if( penentrate )
|
||||
{
|
||||
feeder.pan( undefined, Y - moreAt );
|
||||
}
|
||||
else if( feeder.linesTotal < Y )
|
||||
{
|
||||
while( !feeder.EOF )
|
||||
{
|
||||
i ++;
|
||||
feeder.pan( undefined, 1 );
|
||||
}
|
||||
else break;
|
||||
}
|
||||
else
|
||||
{
|
||||
var lastLine = feeder.lastBuffer.lineNum;
|
||||
var lineShift = Y - feeder.moreAt;
|
||||
|
||||
i = lineShift;
|
||||
while( !feeder.EOF )
|
||||
{
|
||||
feeder.pan( undefined, i );
|
||||
|
||||
// if it turns out to be the same line
|
||||
// before after panning
|
||||
// we keep scrolling it ( panning )
|
||||
// until the entire line cosumes the screen
|
||||
if( feeder.lastBuffer.lineNum == lastLine )
|
||||
{
|
||||
i ++;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
// The line number cursor need to be in
|
||||
Y = lastLine + lineShift;
|
||||
}
|
||||
|
||||
// The line number cursor need to be in
|
||||
Y = lastLine + lineShift;
|
||||
|
||||
// Calculate the visual line position
|
||||
// Calculate the visual line position "i"
|
||||
for( i = 0, line = feeder.firstBuffer;
|
||||
line != feeder.lastBuffer;
|
||||
line = line.next )
|
||||
|
@ -9,6 +9,8 @@
|
||||
/** @type {Components.Vim.Cursor} */
|
||||
var Cursor = ns[ NS_INVOKE ]( "Cursor" );
|
||||
|
||||
var occurence = __import( "System.utils.Perf.CountSubstr" );
|
||||
|
||||
var Feeder = function( rows, cols )
|
||||
{
|
||||
var lineBuffers = [];
|
||||
@ -170,7 +172,7 @@
|
||||
};
|
||||
|
||||
__readOnly( Feeder.prototype, "linesTotal", function() {
|
||||
return this.content.match( "\n" );
|
||||
return occurence( this.content, "\n" );
|
||||
} );
|
||||
|
||||
__readOnly( Feeder.prototype, "firstBuffer", function() {
|
||||
|
@ -37,6 +37,8 @@ Components.Vim.LineFeeder.panY;
|
||||
/** @type Number */
|
||||
Components.Vim.LineFeeder.moreAt;
|
||||
/** @type Number */
|
||||
Components.Vim.LineFeeder.linesTotal;
|
||||
/** @type Number */
|
||||
Components.Vim.LineFeeder.linesOccupied;
|
||||
/** @type String */
|
||||
Components.Vim.LineFeeder.docPos;
|
||||
|
Loading…
Reference in New Issue
Block a user