00155bd406dacc6f2d79b8de025719ac.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 = /** @class */ (function () {
  5. function StatusBar(editor, parentNode) {
  6. this.element = dom.createElement("div");
  7. this.element.className = "ace_status-indicator";
  8. this.element.style.cssText = "display: inline-block;";
  9. parentNode.appendChild(this.element);
  10. var statusUpdate = lang.delayedCall(function () {
  11. this.updateStatus(editor);
  12. }.bind(this)).schedule.bind(null, 100);
  13. editor.on("changeStatus", statusUpdate);
  14. editor.on("changeSelection", statusUpdate);
  15. editor.on("keyboardActivity", statusUpdate);
  16. }
  17. StatusBar.prototype.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. return StatusBar;
  38. }());
  39. exports.StatusBar = StatusBar;
  40. }); (function() {
  41. ace.require(["ace/ext/statusbar"], function(m) {
  42. if (typeof module == "object" && typeof exports == "object" && module) {
  43. module.exports = m;
  44. }
  45. });
  46. })();