commit 6c39f480bfae27b0293719a44bf676cbb97294fc
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2017-03-02T10:26:14Z |
| subject | can now q! |
commit 6c39f480bfae27b0293719a44bf676cbb97294fc
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2017-03-02T10:26:14Z
can now q!
---
botanjs/src/Components/Vim/Actions/QUIT.js | 9 ++++++++-
botanjs/src/Components/Vim/Cursor.js | 5 +++--
botanjs/src/Components/Vim/VimArea.js | 1 -
botanjs/src/Components/Vim/_this.js | 1 +
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/botanjs/src/Components/Vim/Actions/QUIT.js b/botanjs/src/Components/Vim/Actions/QUIT.js
index a32631d..9edcf87 100644
--- a/botanjs/src/Components/Vim/Actions/QUIT.js
+++ b/botanjs/src/Components/Vim/Actions/QUIT.js
@@ -35,7 +35,14 @@
var cur = this.__cursor;
var Vim = cur.Vim;
- if( cur.rec.changed )
+ var forceQuit = p.join( "" ).trim();
+ if( forceQuit && forceQuit[0] == "!" && 1 < forceQuit.length )
+ {
+ this.__msg = VimError( "E488" );
+ return false;
+ }
+
+ if( !forceQuit && cur.rec.changed )
{
var msg = VimError( "E37" );
diff --git a/botanjs/src/Components/Vim/Cursor.js b/botanjs/src/Components/Vim/Cursor.js
index 18e327b..f6cd72a 100644
--- a/botanjs/src/Components/Vim/Cursor.js
+++ b/botanjs/src/Components/Vim/Cursor.js
@@ -13,11 +13,12 @@
var LineOffset = function( buffs, l )
{
- /** @type {Components.Vim.LineBuffer} */
var offset = 0;
LineLoop:
- for( var i = 0, line = buffs[0];
+ for( var i = 0,
+ /** @type {Components.Vim.LineBuffer} */
+ line = buffs[0];
line && i < l; i ++ )
{
while( line )
diff --git a/botanjs/src/Components/Vim/VimArea.js b/botanjs/src/Components/Vim/VimArea.js
index a6c825d..aad55ee 100644
--- a/botanjs/src/Components/Vim/VimArea.js
+++ b/botanjs/src/Components/Vim/VimArea.js
@@ -83,7 +83,6 @@
, new EventKey( "Blur", function() { _self.__active = false; } )
];
-
if( detectScreenSize )
{
var val = element.value;
diff --git a/botanjs/src/Components/Vim/_this.js b/botanjs/src/Components/Vim/_this.js
index 062efb8..bd9c236 100644
--- a/botanjs/src/Components/Vim/_this.js
+++ b/botanjs/src/Components/Vim/_this.js
@@ -43,6 +43,7 @@ var VIMRE_VERSION = "1.0.1";
, "E481": "No range allowed"
, "E492": "Not an editor command: %1"
, "E486": "Pattern not found: %1"
+ , "E488": "Trailing characters"
// EXtended Errors
, "EX1": "Pattern Error( %1 )"