Projekt

Obecné

Profil

Stáhnout (1.87 KB) Statistiky
| Větev: | Tag: | Revize:
1
ace.define("ace/ext/statusbar",["require","exports","module","ace/lib/dom","ace/lib/lang"], function(require, exports, module) {
2
"use strict";
3
var dom = require("../lib/dom");
4
var lang = require("../lib/lang");
5

    
6
var StatusBar = function(editor, parentNode) {
7
    this.element = dom.createElement("div");
8
    this.element.className = "ace_status-indicator";
9
    this.element.style.cssText = "display: inline-block;";
10
    parentNode.appendChild(this.element);
11

    
12
    var statusUpdate = lang.delayedCall(function(){
13
        this.updateStatus(editor);
14
    }.bind(this)).schedule.bind(null, 100);
15
    
16
    editor.on("changeStatus", statusUpdate);
17
    editor.on("changeSelection", statusUpdate);
18
    editor.on("keyboardActivity", statusUpdate);
19
};
20

    
21
(function(){
22
    this.updateStatus = function(editor) {
23
        var status = [];
24
        function add(str, separator) {
25
            str && status.push(str, separator || "|");
26
        }
27

    
28
        add(editor.keyBinding.getStatusText(editor));
29
        if (editor.commands.recording)
30
            add("REC");
31
        
32
        var sel = editor.selection;
33
        var c = sel.lead;
34
        
35
        if (!sel.isEmpty()) {
36
            var r = editor.getSelectionRange();
37
            add("(" + (r.end.row - r.start.row) + ":"  +(r.end.column - r.start.column) + ")", " ");
38
        }
39
        add(c.row + ":" + c.column, " ");        
40
        if (sel.rangeCount)
41
            add("[" + sel.rangeCount + "]", " ");
42
        status.pop();
43
        this.element.textContent = status.join("");
44
    };
45
}).call(StatusBar.prototype);
46

    
47
exports.StatusBar = StatusBar;
48

    
49
});                (function() {
50
                    ace.require(["ace/ext/statusbar"], function(m) {
51
                        if (typeof module == "object" && typeof exports == "object" && module) {
52
                            module.exports = m;
53
                        }
54
                    });
55
                })();
56
            
(19-19/244)