penguin/AstroJS

Javascript framework for my blog

botanjs/src/Components/Vim/Actions/REDO.js

raw ยท 963 bytes

(function(){
	var ns = __namespace( "Components.Vim.Actions" );

	var Mesg = __import( "Components.Vim.Message" );

	/**
	 * @constructor
	 * @implements {Components.Vim.IAction}
	 * @param {Components.Vim.Cursor} Cursor
	 */
	var REDO = function( Cursor )
	{
		/** @type {Components.Vim.Cursor} */
		this.__cursor = Cursor;
		this.__message = "REDO COMMAND";
	};

	REDO.prototype.dispose = function() { };
	REDO.prototype.allowMovement = false;

	REDO.prototype.handler = function( e )
	{
		e.preventDefault();

		/** @type {Components.Vim.State.Stack} */
		var stack = this.__cursor.rec.redo();
		if( stack )
		{
			this.__cursor.suppressEvent();
			stack.play();
			this.__cursor.unsuppressEvent();
			this.__message = Mesg( "NCHANGES", "<TODO>", stack.id, stack.time );
		}
		else
		{
			this.__message = Mesg( "REDO_LIMIT" );
		}
	};

	REDO.prototype.getMessage = function()
	{
		return this.__message;
	};

	ns[ NS_EXPORT ]( EX_CLASS, "REDO", REDO );
})();