Sha256: 97c7a7643cc670245b948798f92c1df0b1b86c34128a3fbe835d9db30dbbb3fa

Contents?: true

Size: 1.38 KB

Versions: 11

Compression:

Stored size: 1.38 KB

Contents

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.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 || "|");
        }

        add(editor.keyBinding.getStatusText(editor));
        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;

});

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
gollum-4.1.4 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/statusbar.js
gollum-4.1.3 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/statusbar.js
inc_gollum-4.1.2d lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/statusbar.js
inc_gollum-4.1.2c lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/statusbar.js
gollum-4.1.2 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/statusbar.js
gollum-4.1.1 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/statusbar.js
gollum-4.1.0 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/statusbar.js
gollum-4.0.1 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/statusbar.js
pollypost-0.0.2 vendor/assets/ace-1.1.8/ext/statusbar.js
gollum-4.0.0 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/statusbar.js
gollum-3.1.3 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/statusbar.js