From ddc7058964684cd45a0339fabbf891bf49914933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Fri, 1 Apr 2016 05:22:02 +0800 Subject: [PATCH] calculate document position --- botanjs/src/Components/Vim/Actions/VISUAL.js | 8 ++++---- botanjs/src/Components/Vim/Cursor.js | 2 +- botanjs/src/Components/Vim/LineFeeder.js | 11 +++++++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/botanjs/src/Components/Vim/Actions/VISUAL.js b/botanjs/src/Components/Vim/Actions/VISUAL.js index 060cdbf..6d32caa 100644 --- a/botanjs/src/Components/Vim/Actions/VISUAL.js +++ b/botanjs/src/Components/Vim/Actions/VISUAL.js @@ -16,7 +16,6 @@ { this.__reset( Cursor ); this.__msg = Mesg( "VISUAL" ); - this.__leaveMesg = ""; Cursor.blink = false; Cursor.pSpace = true; @@ -35,7 +34,6 @@ VISUAL.prototype.dispose = function() { - this.__msg = this.__leaveMesg; var c = this.__cursor; c.blink = true; @@ -45,10 +43,12 @@ // This fix the highlighting position of missing phantomSpace // for maximum filled line - if( c.feeder.wrap ) + if( c.feeder.wrap && 0 < c.X ) { + c.suppressEvent(); c.moveX( -1 ); c.moveX( 1 ); + c.unsuppressEvent(); } }; @@ -92,7 +92,7 @@ cur.moveTo( this.__startaP ); } - this.__leaveMesg = Action.getMessage(); + this.__msg = Action.getMessage(); Action.dispose(); cur.unsuppressEvent(); diff --git a/botanjs/src/Components/Vim/Cursor.js b/botanjs/src/Components/Vim/Cursor.js index 07e07b4..be80a42 100644 --- a/botanjs/src/Components/Vim/Cursor.js +++ b/botanjs/src/Components/Vim/Cursor.js @@ -387,7 +387,7 @@ this.__pulseMsg = this.action.getMessage(); this.action = null; - debug.Info( "closeAction" ); + debug.Info( "closeAction: " + this.__pulseMsg ); // Reset the analyzed content this.Vim.contentAnalyzer.reset(); diff --git a/botanjs/src/Components/Vim/LineFeeder.js b/botanjs/src/Components/Vim/LineFeeder.js index 1385ee8..2ead9a0 100644 --- a/botanjs/src/Components/Vim/LineFeeder.js +++ b/botanjs/src/Components/Vim/LineFeeder.js @@ -226,9 +226,16 @@ __readOnly( Feeder.prototype, "docPos", function() { var pos = "ALL"; - if( 0 < this.panY && this.EOF ) + if( 0 < this.panY ) { - pos = "BOTTOM"; + if( this.EOF ) + { + pos = "BOTTOM"; + } + else + { + pos = Math.floor( ( this.panY / ( this.linesTotal - ( this.__rows - 1 ) ) ) * 100 ) + "%"; + } } else {