2014-07-08 20:15:22 +00:00
|
|
|
define("ace/ext/statusbar",["require","exports","module","ace/lib/dom","ace/lib/lang"], function(require, exports, module) {
|
|
|
|
"use strict";
|
2013-12-30 15:00:16 +00:00
|
|
|
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)
|
2015-11-19 16:37:40 +00:00
|
|
|
}.bind(this)).schedule.bind(null, 100);
|
|
|
|
|
|
|
|
editor.on("changeStatus", statusUpdate);
|
|
|
|
editor.on("changeSelection", statusUpdate);
|
|
|
|
editor.on("keyboardActivity", statusUpdate);
|
2013-12-30 15:00:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
(function(){
|
|
|
|
this.updateStatus = function(editor) {
|
|
|
|
var status = [];
|
|
|
|
function add(str, separator) {
|
|
|
|
str && status.push(str, separator || "|");
|
|
|
|
}
|
|
|
|
|
2014-07-08 20:15:22 +00:00
|
|
|
add(editor.keyBinding.getStatusText(editor));
|
|
|
|
if (editor.commands.recording)
|
2013-12-30 15:00:16 +00:00
|
|
|
add("REC");
|
2015-11-19 16:37:40 +00:00
|
|
|
|
|
|
|
var sel = editor.selection;
|
|
|
|
var c = sel.lead;
|
|
|
|
|
|
|
|
if (!sel.isEmpty()) {
|
2013-12-30 15:00:16 +00:00
|
|
|
var r = editor.getSelectionRange();
|
2015-11-19 16:37:40 +00:00
|
|
|
add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")", " ");
|
2013-12-30 15:00:16 +00:00
|
|
|
}
|
2015-11-19 16:37:40 +00:00
|
|
|
add(c.row + ":" + c.column, " ");
|
|
|
|
if (sel.rangeCount)
|
|
|
|
add("[" + sel.rangeCount + "]", " ");
|
2013-12-30 15:00:16 +00:00
|
|
|
status.pop();
|
|
|
|
this.element.textContent = status.join("");
|
|
|
|
};
|
|
|
|
}).call(StatusBar.prototype);
|
|
|
|
|
|
|
|
exports.StatusBar = StatusBar;
|
|
|
|
|
2014-07-08 20:15:22 +00:00
|
|
|
});
|
|
|
|
(function() {
|
|
|
|
window.require(["ace/ext/statusbar"], function() {});
|
|
|
|
})();
|
|
|
|
|