commit ee26a7dcc8b637fe74c0cde9a937036c585888ba
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2016-03-14T19:38:05Z |
| subject | Remove useless imports |
commit ee26a7dcc8b637fe74c0cde9a937036c585888ba
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2016-03-14T19:38:05Z
Remove useless imports
---
botanjs/src/Components/Vim/Actions/INSERT.js | 19 +++---
botanjs/src/Components/Vim/Controls.js | 91 ++++++++++++++++++++++++++++
botanjs/src/Components/Vim/Cursor.js | 12 +---
botanjs/src/Components/Vim/LineBuffer.js | 11 +---
botanjs/src/Components/Vim/LineFeeder.js | 10 +--
botanjs/src/Components/Vim/StatusBar.js | 11 +---
botanjs/src/Components/Vim/VimArea.js | 80 +-----------------------
botanjs/src/Components/Vim/_this.js | 11 ----
8 files changed, 106 insertions(+), 139 deletions(-)
diff --git a/botanjs/src/Components/Vim/Actions/INSERT.js b/botanjs/src/Components/Vim/Actions/INSERT.js
index 4757065..35ff9be 100644
--- a/botanjs/src/Components/Vim/Actions/INSERT.js
+++ b/botanjs/src/Components/Vim/Actions/INSERT.js
@@ -1,17 +1,8 @@
(function(){
var ns = __namespace( "Components.Vim.Actions" );
- /** @type {Dandelion} */
- var Dand = __import( "Dandelion" );
- /** @type {Dandelion.IDOMElement} */
- var IDOMElement = __import( "Dandelion.IDOMElement" );
- /** @type {Dandelion.IDOMObject} */
- var IDOMObject = __import( "Dandelion.IDOMObject" );
- /** @type {System.Cycle} */
- var Cycle = __import( "System.Cycle" );
/** @type {System.Debug} */
- var debug = __import( "System.Debug" );
-
+ var debug = __import( "System.Debug" );
var Mesg = __import( "Components.Vim.Message" );
/** @type {Components.Vim.Cursor.IAction} */
@@ -25,6 +16,14 @@
{
};
+ INSERT.prototype.handler = function( e )
+ {
+ e.preventDefault();
+ if( e.key.length == "1" )
+ {
+ }
+ };
+
INSERT.prototype.getMessage = function()
{
var l = this.cursor.feeder.firstBuffer.cols;
diff --git a/botanjs/src/Components/Vim/Controls.js b/botanjs/src/Components/Vim/Controls.js
new file mode 100644
index 0000000..5dd9dc7
--- /dev/null
+++ b/botanjs/src/Components/Vim/Controls.js
@@ -0,0 +1,91 @@
+(function(){
+ var ns = __namespace( "Components.Vim" );
+
+ var debug = __import( "System.Debug" );
+
+ var Controls = function( sender, e )
+ {
+ // Action Mode handled by the actions themselves
+ var cfeeder = sender.contentFeeder;
+ if( cfeeder.cursor.action )
+ {
+ cfeeder.cursor.action.handler( e );
+ return;
+ }
+
+ if( e.altKey
+ // F2 - F12
+ || ( 112 < e.keyCode && e.keyCode < 124 )
+ ) return;
+
+ e.preventDefault();
+
+ if( e.ctrlKey )
+ {
+ VimComboFunc( sender, e );
+ return;
+ }
+
+ var kCode = e.keyCode + ( e.shiftKey ? 1000 : 0 );
+
+ var cfeeder = sender.contentFeeder;
+ var sfeeder = sender.statusFeeder;
+ switch( kCode )
+ {
+ // Cursor movements
+ case 8: // Backspace, go back 1 char, regardless of line
+ break;
+ case 72: // h
+ cfeeder.cursor.moveX( -1 );
+ break;
+ case 74: // j
+ cfeeder.cursor.moveY( 1 );
+ break;
+ case 75: // k
+ cfeeder.cursor.moveY( -1 );
+ break;
+ case 76: // l
+ cfeeder.cursor.moveX( 1 );
+ break;
+
+ // Insert
+ case 65: // a
+ cfeeder.cursor.openInsert();
+ break;
+
+ case 1065: // A, append at the line end
+ break;
+ case 73: // i
+ break;
+ case 1073: // I, append before the line start, after spaces
+ break;
+
+ // remove characters
+ case 88: // x, remove in cursor
+ break;
+ case 1088: // X, remove before cursor
+ break;
+
+ case 1072: // H, First line buffer
+ break;
+ case 1076: // L, Last line buffer
+ break;
+ case 1052: // $
+ cfeeder.cursor.lineEnd();
+ break;
+ case 1053: // %
+ break;
+ case 1054: // ^
+ cfeeder.cursor.lineStart();
+ break;
+ case 1074: // J, Join lines
+ break;
+ case 1075: // K, manual entry
+ break;
+ case 112: // F1, help
+ }
+
+ };
+
+ ns[ NS_EXPORT ]( EX_FUNC, "Controls", Controls );
+})();
diff --git a/botanjs/src/Components/Vim/Cursor.js b/botanjs/src/Components/Vim/Cursor.js
index cb58611..cdebae7 100644
--- a/botanjs/src/Components/Vim/Cursor.js
+++ b/botanjs/src/Components/Vim/Cursor.js
@@ -1,16 +1,8 @@
(function(){
var ns = __namespace( "Components.Vim" );
- /** @type {Dandelion} */
- var Dand = __import( "Dandelion" );
- /** @type {Dandelion.IDOMElement} */
- var IDOMElement = __import( "Dandelion.IDOMElement" );
- /** @type {Dandelion.IDOMObject} */
- var IDOMObject = __import( "Dandelion.IDOMObject" );
- /** @type {System.Cycle} */
- var Cycle = __import( "System.Cycle" );
/** @type {System.Debug} */
- var debug = __import( "System.Debug" );
+ var debug = __import( "System.Debug" );
var Actions = __import( "Components.Vim.Actions.*" );
@@ -219,7 +211,7 @@
{
var feeder = this.feeder;
if( this.action ) this.action.dispose();
- this.action = new Actions[ "INSERT" ];
+ this.action = new (Actions[ "INSERT" ])( this );
feeder.dispatcher.dispatchEvent( new BotanEvent( "VisualUpdate" ) );
};
diff --git a/botanjs/src/Components/Vim/LineBuffer.js b/botanjs/src/Components/Vim/LineBuffer.js
index 51c9861..41bbb03 100644
--- a/botanjs/src/Components/Vim/LineBuffer.js
+++ b/botanjs/src/Components/Vim/LineBuffer.js
@@ -1,16 +1,7 @@
(function(){
var ns = __namespace( "Components.Vim" );
- /** @type {Dandelion} */
- var Dand = __import( "Dandelion" );
- /** @type {Dandelion.IDOMElement} */
- var IDOMElement = __import( "Dandelion.IDOMElement" );
- /** @type {Dandelion.IDOMObject} */
- var IDOMObject = __import( "Dandelion.IDOMObject" );
- /** @type {System.Cycle} */
- var Cycle = __import( "System.Cycle" );
- /** @type {System.Debug} */
- var debug = __import( "System.Debug" );
+ var debug = __import( "System.Debug" );
var LineBuffer = function( cols, nextLineBuffer )
{
diff --git a/botanjs/src/Components/Vim/LineFeeder.js b/botanjs/src/Components/Vim/LineFeeder.js
index 61807a2..04842af 100644
--- a/botanjs/src/Components/Vim/LineFeeder.js
+++ b/botanjs/src/Components/Vim/LineFeeder.js
@@ -1,16 +1,8 @@
(function(){
var ns = __namespace( "Components.Vim" );
- /** @type {Dandelion} */
- var Dand = __import( "Dandelion" );
- /** @type {Dandelion.IDOMElement} */
- var IDOMElement = __import( "Dandelion.IDOMElement" );
- /** @type {Dandelion.IDOMObject} */
- var IDOMObject = __import( "Dandelion.IDOMObject" );
- /** @type {System.Cycle} */
- var Cycle = __import( "System.Cycle" );
/** @type {System.Debug} */
- var debug = __import( "System.Debug" );
+ var debug = __import( "System.Debug" );
/** @type {Components.Vim.LineBuffer} */
var LineBuffer = ns[ NS_INVOKE ]( "LineBuffer" );
diff --git a/botanjs/src/Components/Vim/StatusBar.js b/botanjs/src/Components/Vim/StatusBar.js
index ecdec78..c02f82c 100644
--- a/botanjs/src/Components/Vim/StatusBar.js
+++ b/botanjs/src/Components/Vim/StatusBar.js
@@ -1,16 +1,7 @@
(function(){
var ns = __namespace( "Components.Vim" );
- /** @type {Dandelion} */
- var Dand = __import( "Dandelion" );
- /** @type {Dandelion.IDOMElement} */
- var IDOMElement = __import( "Dandelion.IDOMElement" );
- /** @type {Dandelion.IDOMObject} */
- var IDOMObject = __import( "Dandelion.IDOMObject" );
- /** @type {System.Cycle} */
- var Cycle = __import( "System.Cycle" );
- /** @type {System.Debug} */
- var debug = __import( "System.Debug" );
+ var debug = __import( "System.Debug" );
/** @type {Components.VimArea.LineFeeder} */
var LineFeeder = ns[ NS_INVOKE ]( "LineFeeder" );
diff --git a/botanjs/src/Components/Vim/VimArea.js b/botanjs/src/Components/Vim/VimArea.js
index e4d00c9..d471f54 100644
--- a/botanjs/src/Components/Vim/VimArea.js
+++ b/botanjs/src/Components/Vim/VimArea.js
@@ -1,12 +1,8 @@
(function(){
var ns = __namespace( "Components.Vim" );
- /** @type {Dandelion} */
- var Dand = __import( "Dandelion" );
/** @type {Dandelion.IDOMElement} */
var IDOMElement = __import( "Dandelion.IDOMElement" );
- /** @type {Dandelion.IDOMObject} */
- var IDOMObject = __import( "Dandelion.IDOMObject" );
/** @type {System.utils.DataKey} */
var DataKey = __import( "System.utils.DataKey" );
/** @type {System.Cycle} */
@@ -19,6 +15,7 @@
/** @type {Components.Vim.StatusBar} */
var StatusBar = ns[ NS_INVOKE ]( "StatusBar" );
+ var VimControls = ns[ NS_INVOKE ]( "Controls" );
var mesg = ns[ NS_INVOKE ]( "Message" );
var KeyHandler = function( sender, handler )
@@ -33,81 +30,6 @@
};
};
- var VimControls = function( sender, e )
- {
- if( e.altKey
- // F2 - F12
- || ( 112 < e.keyCode && e.keyCode < 124 )
- ) return;
-
- e.preventDefault();
- if( e.ctrlKey )
- {
- VimComboFunc( sender, e );
- return;
- }
-
- var kCode = e.keyCode + ( e.shiftKey ? 1000 : 0 );
-
- var cfeeder = sender.contentFeeder;
- var sfeeder = sender.statusFeeder;
- switch( kCode )
- {
- // Cursor movements
- case 8: // Backspace, go back 1 char, regardless of line
- break;
- case 72: // h
- cfeeder.cursor.moveX( -1 );
- break;
- case 74: // j
- cfeeder.cursor.moveY( 1 );
- break;
- case 75: // k
- cfeeder.cursor.moveY( -1 );
- break;
- case 76: // l
- cfeeder.cursor.moveX( 1 );
- break;
-
- // Insert
- case 65: // a
- cfeeder.cursor.openInsert();
- break;
-
- case 1065: // A, append at the line end
- break;
- case 73: // i
- break;
- case 1073: // I, append before the line start, after spaces
- break;
-
- // remove characters
- case 88: // x, remove in cursor
- break;
- case 1088: // X, remove before cursor
- break;
-
- case 1072: // H, First line buffer
- break;
- case 1076: // L, Last line buffer
- break;
- case 1052: // $
- cfeeder.cursor.lineEnd();
- break;
- case 1053: // %
- break;
- case 1054: // ^
- cfeeder.cursor.lineStart();
- break;
- case 1074: // J, Join lines
- break;
- case 1075: // K, manual entry
- break;
- case 112: // F1, help
- }
-
- };
-
/* stage @param {Dandelion.IDOMElement} */
var VimArea = function( stage )
{
diff --git a/botanjs/src/Components/Vim/_this.js b/botanjs/src/Components/Vim/_this.js
index d45751f..0ed8cd0 100644
--- a/botanjs/src/Components/Vim/_this.js
+++ b/botanjs/src/Components/Vim/_this.js
@@ -1,17 +1,6 @@
(function(){
var ns = __namespace( "Components.Vim" );
- /** @type {Dandelion} */
- var Dand = __import( "Dandelion" );
- /** @type {Dandelion.IDOMElement} */
- var IDOMElement = __import( "Dandelion.IDOMElement" );
- /** @type {Dandelion.IDOMObject} */
- var IDOMObject = __import( "Dandelion.IDOMObject" );
- /** @type {System.Cycle} */
- var Cycle = __import( "System.Cycle" );
- /** @type {System.Debug} */
- var debug = __import( "System.Debug" );
-
var messages = {
"INSERT": "-- INSERT --"
, "REPLACE": "-- REPLACE --"