2014-07-16 06:07:18 -04:00
|
|
|
ace.define("ace/ext/statusbar",["require","exports","module","ace/lib/dom","ace/lib/lang"], function(require, exports, module) {
|
2014-02-12 05:23:40 -05:00
|
|
|
"use strict";
|
|
|
|
var dom = require("ace/lib/dom");
|
|
|
|
var lang = require("ace/lib/lang");
|
|
|
|
|
|
|
|
var StatusBar = function(editor, parentNode) {
|
|
|
|
this.element = dom.createElement("div");
|
|
|
|
this.element.className = "ace_status-indicator";
|
|
|
|
this.element.style.cssText = "display: inline-block;";
|
|
|
|
parentNode.appendChild(this.element);
|
|
|
|
|
|
|
|
var statusUpdate = lang.delayedCall(function(){
|
|
|
|
this.updateStatus(editor)
|
|
|
|
}.bind(this));
|
|
|
|
editor.on("changeStatus", function() {
|
|
|
|
statusUpdate.schedule(100);
|
|
|
|
});
|
|
|
|
editor.on("changeSelection", function() {
|
|
|
|
statusUpdate.schedule(100);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
(function(){
|
|
|
|
this.updateStatus = function(editor) {
|
|
|
|
var status = [];
|
|
|
|
function add(str, separator) {
|
|
|
|
str && status.push(str, separator || "|");
|
|
|
|
}
|
|
|
|
|
2015-02-12 05:36:57 -05:00
|
|
|
add(editor.keyBinding.getStatusText(editor));
|
|
|
|
if (editor.commands.recording)
|
2014-02-12 05:23:40 -05:00
|
|
|
add("REC");
|
|
|
|
|
|
|
|
var c = editor.selection.lead;
|
|
|
|
add(c.row + ":" + c.column, " ");
|
|
|
|
if (!editor.selection.isEmpty()) {
|
|
|
|
var r = editor.getSelectionRange();
|
|
|
|
add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")");
|
|
|
|
}
|
|
|
|
status.pop();
|
|
|
|
this.element.textContent = status.join("");
|
|
|
|
};
|
|
|
|
}).call(StatusBar.prototype);
|
|
|
|
|
|
|
|
exports.StatusBar = StatusBar;
|
|
|
|
|
2014-07-09 12:59:04 -04:00
|
|
|
});
|
|
|
|
(function() {
|
2014-07-16 06:07:18 -04:00
|
|
|
ace.require(["ace/ext/statusbar"], function() {});
|
2014-07-09 12:59:04 -04:00
|
|
|
})();
|
|
|
|
|