2023-01-16 22:26:34 +00:00
|
|
|
ace.define("ace/ext/statusbar",["require","exports","module","ace/lib/dom","ace/lib/lang"], function(require, exports, module){"use strict";
|
2020-04-14 12:14:48 +00:00
|
|
|
var dom = require("../lib/dom");
|
|
|
|
var lang = require("../lib/lang");
|
2023-01-16 22:26:34 +00:00
|
|
|
var StatusBar = function (editor, parentNode) {
|
2013-12-30 15:00:16 +00:00
|
|
|
this.element = dom.createElement("div");
|
|
|
|
this.element.className = "ace_status-indicator";
|
|
|
|
this.element.style.cssText = "display: inline-block;";
|
|
|
|
parentNode.appendChild(this.element);
|
2023-01-16 22:26:34 +00:00
|
|
|
var statusUpdate = lang.delayedCall(function () {
|
2020-04-14 12:14:48 +00:00
|
|
|
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
|
|
|
};
|
2023-01-16 22:26:34 +00:00
|
|
|
(function () {
|
|
|
|
this.updateStatus = function (editor) {
|
2013-12-30 15:00:16 +00:00
|
|
|
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();
|
2023-01-16 22:26:34 +00:00
|
|
|
add("(" + (r.end.row - r.start.row) + ":" + (r.end.column - r.start.column) + ")", " ");
|
2013-12-30 15:00:16 +00:00
|
|
|
}
|
2023-01-16 22:26:34 +00:00
|
|
|
add(c.row + ":" + c.column, " ");
|
2015-11-19 16:37:40 +00:00
|
|
|
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;
|
|
|
|
|
2020-04-14 12:14:48 +00:00
|
|
|
}); (function() {
|
|
|
|
ace.require(["ace/ext/statusbar"], function(m) {
|
|
|
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
|
|
|
module.exports = m;
|
|
|
|
}
|
|
|
|
});
|
2014-07-08 20:15:22 +00:00
|
|
|
})();
|
|
|
|
|