kitchen sink using statusbar extension
I refactored the kitchen sink to use the statusbar extension, deleted the build directory, did a full rebuild and it works. :D
This commit is contained in:
parent
2b362a2fa1
commit
d0d3ca2de8
3 changed files with 7 additions and 49 deletions
|
|
@ -458,7 +458,7 @@ event.addListener(container, "drop", function(e) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var StatusBar = require("./statusbar").StatusBar;
|
var StatusBar = require("ace/ext/statusbar").StatusBar;
|
||||||
new StatusBar(env.editor, cmdLine.container);
|
new StatusBar(env.editor, cmdLine.container);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
define(function(require, exports, module) {
|
|
||||||
"use strict";
|
|
||||||
/** simple statusbar **/
|
|
||||||
var dom = require("ace/lib/dom");
|
|
||||||
var lang = require("ace/lib/lang");
|
|
||||||
|
|
||||||
var StatusBar = function(editor, parentNode) {
|
|
||||||
this.element = dom.createElement("div");
|
|
||||||
this.element.style.cssText = "color: gray; position:absolute; right:0; border-left:1px solid";
|
|
||||||
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;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
@ -42,3 +42,9 @@ body {
|
||||||
#controls td + td {
|
#controls td + td {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
#lineColIndicator {
|
||||||
|
color: gray;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
border-left: 1px solid;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue