From 4311ff3a6eed629ce081c020d2598e2107059220 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: Mon, 20 Mar 2017 12:47:02 +0800 Subject: [PATCH] Draft Actions MARK --- botanjs/src/Components/Vim/Actions/MARK.js | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 botanjs/src/Components/Vim/Actions/MARK.js diff --git a/botanjs/src/Components/Vim/Actions/MARK.js b/botanjs/src/Components/Vim/Actions/MARK.js new file mode 100644 index 0000000..1c0e0dd --- /dev/null +++ b/botanjs/src/Components/Vim/Actions/MARK.js @@ -0,0 +1,45 @@ +(function(){ + var ns = __namespace( "Components.Vim.Actions" ); + + /** @type {System.Debug} */ + var debug = __import( "System.Debug" ); + + var beep = __import( "Components.Vim.Beep" ); + + /** @type {Components.Vim.IAction} */ + var MARK = function( Cursor ) + { + /** @type {Components.Vim.Cursor} */ + this.__cursor = Cursor; + this.__msg = ""; + }; + + MARK.prototype.dispose = function() { }; + + MARK.prototype.handler = function( e, cmd ) + { + e.preventDefault(); + + /** @type {Components.Vim.State.Marks} */ + var marks = e.target.marks; + + var ccur = this.__cursor; + if( cmd && cmd[0] ) + { + marks.set( cmd.join( "" ).trim(), ccur.getLine().lineNum, ccur.aX ); + } + else + { + marks.set( e.key, ccur.getLine().lineNum, ccur.aX ); + } + + return true; + }; + + MARK.prototype.getMessage = function() + { + return this.__msg; + }; + + ns[ NS_EXPORT ]( EX_CLASS, "MARK", MARK ); +})();