mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor
synced 2024-12-20 02:31:43 +00:00
7847555702
Updates ACE to commit: 4949e18f00e4dbf34fc8a213909ef6ae3e1a1015
This includes fixes for IE7/8 support, which was broken in the last ACE
release. Specifically
051128c16f (diff-502b909e9de186749df3051f8d4bfa42L137)
Bug: 64559
Change-Id: I0765c5f95de81a5ce9632f6eb5422b98c02941ff
47 lines
1.5 KiB
JavaScript
47 lines
1.5 KiB
JavaScript
define('ace/ext/statusbar', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/lang'], function(require, exports, module) {
|
|
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 || "|");
|
|
}
|
|
|
|
if (editor.$vimModeHandler)
|
|
add(editor.$vimModeHandler.getStatusText());
|
|
else if (editor.commands.recording)
|
|
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;
|
|
|
|
}); |