ae72f92a2ea2219a6a8c58e8ae557385.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ace.define("ace/ext/statusbar",["require","exports","module","ace/lib/dom","ace/lib/lang"], function(require, exports, module){"use strict";
  2. var dom = require("../lib/dom");
  3. var lang = require("../lib/lang");
  4. var StatusBar = function (editor, parentNode) {
  5. this.element = dom.createElement("div");
  6. this.element.className = "ace_status-indicator";
  7. this.element.style.cssText = "display: inline-block;";
  8. parentNode.appendChild(this.element);
  9. var statusUpdate = lang.delayedCall(function () {
  10. this.updateStatus(editor);
  11. }.bind(this)).schedule.bind(null, 100);
  12. editor.on("changeStatus", statusUpdate);
  13. editor.on("changeSelection", statusUpdate);
  14. editor.on("keyboardActivity", statusUpdate);
  15. };
  16. (function () {
  17. this.updateStatus = function (editor) {
  18. var status = [];
  19. function add(str, separator) {
  20. str && status.push(str, separator || "|");
  21. }
  22. add(editor.keyBinding.getStatusText(editor));
  23. if (editor.commands.recording)
  24. add("REC");
  25. var sel = editor.selection;
  26. var c = sel.lead;
  27. if (!sel.isEmpty()) {
  28. var r = editor.getSelectionRange();
  29. add("(" + (r.end.row - r.start.row) + ":" + (r.end.column - r.start.column) + ")", " ");
  30. }
  31. add(c.row + ":" + c.column, " ");
  32. if (sel.rangeCount)
  33. add("[" + sel.rangeCount + "]", " ");
  34. status.pop();
  35. this.element.textContent = status.join("");
  36. };
  37. }).call(StatusBar.prototype);
  38. exports.StatusBar = StatusBar;
  39. }); (function() {
  40. ace.require(["ace/ext/statusbar"], function(m) {
  41. if (typeof module == "object" && typeof exports == "object" && module) {
  42. module.exports = m;
  43. }
  44. });
  45. })();