783bd9a28d2a45d4c721a6a89b11699f.js 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067
  1. ace.define("ace/occur",["require","exports","module","ace/lib/oop","ace/search","ace/edit_session","ace/search_highlight","ace/lib/dom"], function(require, exports, module){"use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. if (typeof b !== "function" && b !== null)
  11. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  12. extendStatics(d, b);
  13. function __() { this.constructor = d; }
  14. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15. };
  16. })();
  17. var oop = require("./lib/oop");
  18. var Search = require("./search").Search;
  19. var EditSession = require("./edit_session").EditSession;
  20. var SearchHighlight = require("./search_highlight").SearchHighlight;
  21. var Occur = /** @class */ (function (_super) {
  22. __extends(Occur, _super);
  23. function Occur() {
  24. return _super !== null && _super.apply(this, arguments) || this;
  25. }
  26. Occur.prototype.enter = function (editor, options) {
  27. if (!options.needle)
  28. return false;
  29. var pos = editor.getCursorPosition();
  30. this.displayOccurContent(editor, options);
  31. var translatedPos = this.originalToOccurPosition(editor.session, pos);
  32. editor.moveCursorToPosition(translatedPos);
  33. return true;
  34. };
  35. Occur.prototype.exit = function (editor, options) {
  36. var pos = options.translatePosition && editor.getCursorPosition();
  37. var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos);
  38. this.displayOriginalContent(editor);
  39. if (translatedPos)
  40. editor.moveCursorToPosition(translatedPos);
  41. return true;
  42. };
  43. Occur.prototype.highlight = function (sess, regexp) {
  44. var hl = sess.$occurHighlight = sess.$occurHighlight || sess.addDynamicMarker(new SearchHighlight(null, "ace_occur-highlight", "text"));
  45. hl.setRegexp(regexp);
  46. sess._emit("changeBackMarker"); // force highlight layer redraw
  47. };
  48. Occur.prototype.displayOccurContent = function (editor, options) {
  49. this.$originalSession = editor.session;
  50. var found = this.matchingLines(editor.session, options);
  51. var lines = found.map(function (foundLine) { return foundLine.content; });
  52. var occurSession = new EditSession(lines.join('\n'));
  53. occurSession.$occur = this;
  54. occurSession.$occurMatchingLines = found;
  55. editor.setSession(occurSession);
  56. this.$useEmacsStyleLineStart = this.$originalSession.$useEmacsStyleLineStart;
  57. occurSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;
  58. this.highlight(occurSession, options.re);
  59. occurSession._emit('changeBackMarker');
  60. };
  61. Occur.prototype.displayOriginalContent = function (editor) {
  62. editor.setSession(this.$originalSession);
  63. this.$originalSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;
  64. };
  65. Occur.prototype.originalToOccurPosition = function (session, pos) {
  66. var lines = session.$occurMatchingLines;
  67. var nullPos = { row: 0, column: 0 };
  68. if (!lines)
  69. return nullPos;
  70. for (var i = 0; i < lines.length; i++) {
  71. if (lines[i].row === pos.row)
  72. return { row: i, column: pos.column };
  73. }
  74. return nullPos;
  75. };
  76. Occur.prototype.occurToOriginalPosition = function (session, pos) {
  77. var lines = session.$occurMatchingLines;
  78. if (!lines || !lines[pos.row])
  79. return pos;
  80. return { row: lines[pos.row].row, column: pos.column };
  81. };
  82. Occur.prototype.matchingLines = function (session, options) {
  83. options = oop.mixin({}, options);
  84. if (!session || !options.needle)
  85. return [];
  86. var search = new Search();
  87. search.set(options);
  88. return search.findAll(session).reduce(function (lines, range) {
  89. var row = range.start.row;
  90. var last = lines[lines.length - 1];
  91. return last && last.row === row ?
  92. lines :
  93. lines.concat({ row: row, content: session.getLine(row) });
  94. }, []);
  95. };
  96. return Occur;
  97. }(Search));
  98. var dom = require('./lib/dom');
  99. dom.importCssString(".ace_occur-highlight {\n\
  100. border-radius: 4px;\n\
  101. background-color: rgba(87, 255, 8, 0.25);\n\
  102. position: absolute;\n\
  103. z-index: 4;\n\
  104. box-sizing: border-box;\n\
  105. box-shadow: 0 0 4px rgb(91, 255, 50);\n\
  106. }\n\
  107. .ace_dark .ace_occur-highlight {\n\
  108. background-color: rgb(80, 140, 85);\n\
  109. box-shadow: 0 0 4px rgb(60, 120, 70);\n\
  110. }\n", "incremental-occur-highlighting", false);
  111. exports.Occur = Occur;
  112. });
  113. ace.define("ace/commands/occur_commands",["require","exports","module","ace/config","ace/occur","ace/keyboard/hash_handler","ace/lib/oop"], function(require, exports, module){var config = require("../config"), Occur = require("../occur").Occur;
  114. var occurStartCommand = {
  115. name: "occur",
  116. exec: function (editor, options) {
  117. var alreadyInOccur = !!editor.session.$occur;
  118. var occurSessionActive = new Occur().enter(editor, options);
  119. if (occurSessionActive && !alreadyInOccur)
  120. OccurKeyboardHandler.installIn(editor);
  121. },
  122. readOnly: true
  123. };
  124. var occurCommands = [{
  125. name: "occurexit",
  126. bindKey: 'esc|Ctrl-G',
  127. exec: function (editor) {
  128. var occur = editor.session.$occur;
  129. if (!occur)
  130. return;
  131. occur.exit(editor, {});
  132. if (!editor.session.$occur)
  133. OccurKeyboardHandler.uninstallFrom(editor);
  134. },
  135. readOnly: true
  136. }, {
  137. name: "occuraccept",
  138. bindKey: 'enter',
  139. exec: function (editor) {
  140. var occur = editor.session.$occur;
  141. if (!occur)
  142. return;
  143. occur.exit(editor, { translatePosition: true });
  144. if (!editor.session.$occur)
  145. OccurKeyboardHandler.uninstallFrom(editor);
  146. },
  147. readOnly: true
  148. }];
  149. var HashHandler = require("../keyboard/hash_handler").HashHandler;
  150. var oop = require("../lib/oop");
  151. function OccurKeyboardHandler() { }
  152. oop.inherits(OccurKeyboardHandler, HashHandler);
  153. (function () {
  154. this.isOccurHandler = true;
  155. this.attach = function (editor) {
  156. HashHandler.call(this, occurCommands, editor.commands.platform);
  157. this.$editor = editor;
  158. };
  159. var handleKeyboard$super = this.handleKeyboard;
  160. this.handleKeyboard = function (data, hashId, key, keyCode) {
  161. var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
  162. return (cmd && cmd.command) ? cmd : undefined;
  163. };
  164. }).call(OccurKeyboardHandler.prototype);
  165. OccurKeyboardHandler.installIn = function (editor) {
  166. var handler = new this();
  167. editor.keyBinding.addKeyboardHandler(handler);
  168. editor.commands.addCommands(occurCommands);
  169. };
  170. OccurKeyboardHandler.uninstallFrom = function (editor) {
  171. editor.commands.removeCommands(occurCommands);
  172. var handler = editor.getKeyboardHandler();
  173. if (handler.isOccurHandler)
  174. editor.keyBinding.removeKeyboardHandler(handler);
  175. };
  176. exports.occurStartCommand = occurStartCommand;
  177. });
  178. ace.define("ace/commands/incremental_search_commands",["require","exports","module","ace/config","ace/lib/oop","ace/keyboard/hash_handler","ace/commands/occur_commands"], function(require, exports, module){var config = require("../config");
  179. var oop = require("../lib/oop");
  180. var HashHandler = require("../keyboard/hash_handler").HashHandler;
  181. var occurStartCommand = require("./occur_commands").occurStartCommand;
  182. exports.iSearchStartCommands = [{
  183. name: "iSearch",
  184. bindKey: { win: "Ctrl-F", mac: "Command-F" },
  185. exec: function (editor, options) {
  186. config.loadModule(["core", "ace/incremental_search"], function (e) {
  187. var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch();
  188. iSearch.activate(editor, options.backwards);
  189. if (options.jumpToFirstMatch)
  190. iSearch.next(options);
  191. });
  192. },
  193. readOnly: true
  194. }, {
  195. name: "iSearchBackwards",
  196. exec: function (editor, jumpToNext) { editor.execCommand('iSearch', { backwards: true }); },
  197. readOnly: true
  198. }, {
  199. name: "iSearchAndGo",
  200. bindKey: { win: "Ctrl-K", mac: "Command-G" },
  201. exec: function (editor, jumpToNext) { editor.execCommand('iSearch', { jumpToFirstMatch: true, useCurrentOrPrevSearch: true }); },
  202. readOnly: true
  203. }, {
  204. name: "iSearchBackwardsAndGo",
  205. bindKey: { win: "Ctrl-Shift-K", mac: "Command-Shift-G" },
  206. exec: function (editor) { editor.execCommand('iSearch', { jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true }); },
  207. readOnly: true
  208. }];
  209. exports.iSearchCommands = [{
  210. name: "restartSearch",
  211. bindKey: { win: "Ctrl-F", mac: "Command-F" },
  212. exec: function (iSearch) {
  213. iSearch.cancelSearch(true);
  214. }
  215. }, {
  216. name: "searchForward",
  217. bindKey: { win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G" },
  218. exec: function (iSearch, options) {
  219. options.useCurrentOrPrevSearch = true;
  220. iSearch.next(options);
  221. }
  222. }, {
  223. name: "searchBackward",
  224. bindKey: { win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G" },
  225. exec: function (iSearch, options) {
  226. options.useCurrentOrPrevSearch = true;
  227. options.backwards = true;
  228. iSearch.next(options);
  229. }
  230. }, {
  231. name: "extendSearchTerm",
  232. exec: function (iSearch, string) {
  233. iSearch.addString(string);
  234. }
  235. }, {
  236. name: "extendSearchTermSpace",
  237. bindKey: "space",
  238. exec: function (iSearch) { iSearch.addString(' '); }
  239. }, {
  240. name: "shrinkSearchTerm",
  241. bindKey: "backspace",
  242. exec: function (iSearch) {
  243. iSearch.removeChar();
  244. }
  245. }, {
  246. name: 'confirmSearch',
  247. bindKey: 'return',
  248. exec: function (iSearch) { iSearch.deactivate(); }
  249. }, {
  250. name: 'cancelSearch',
  251. bindKey: 'esc|Ctrl-G',
  252. exec: function (iSearch) { iSearch.deactivate(true); }
  253. }, {
  254. name: 'occurisearch',
  255. bindKey: 'Ctrl-O',
  256. exec: function (iSearch) {
  257. var options = oop.mixin({}, iSearch.$options);
  258. iSearch.deactivate();
  259. occurStartCommand.exec(iSearch.$editor, options);
  260. }
  261. }, {
  262. name: "yankNextWord",
  263. bindKey: "Ctrl-w",
  264. exec: function (iSearch) {
  265. var ed = iSearch.$editor, range = ed.selection.getRangeOfMovements(function (sel) { sel.moveCursorWordRight(); }), string = ed.session.getTextRange(range);
  266. iSearch.addString(string);
  267. }
  268. }, {
  269. name: "yankNextChar",
  270. bindKey: "Ctrl-Alt-y",
  271. exec: function (iSearch) {
  272. var ed = iSearch.$editor, range = ed.selection.getRangeOfMovements(function (sel) { sel.moveCursorRight(); }), string = ed.session.getTextRange(range);
  273. iSearch.addString(string);
  274. }
  275. }, {
  276. name: 'recenterTopBottom',
  277. bindKey: 'Ctrl-l',
  278. exec: function (iSearch) { iSearch.$editor.execCommand('recenterTopBottom'); }
  279. }, {
  280. name: 'selectAllMatches',
  281. bindKey: 'Ctrl-space',
  282. exec: function (iSearch) {
  283. var ed = iSearch.$editor, hl = ed.session.$isearchHighlight, ranges = hl && hl.cache ? hl.cache
  284. .reduce(function (ranges, ea) {
  285. return ranges.concat(ea ? ea : []);
  286. }, []) : [];
  287. iSearch.deactivate(false);
  288. ranges.forEach(ed.selection.addRange.bind(ed.selection));
  289. }
  290. }, {
  291. name: 'searchAsRegExp',
  292. bindKey: 'Alt-r',
  293. exec: function (iSearch) {
  294. iSearch.convertNeedleToRegExp();
  295. }
  296. }].map(function (cmd) {
  297. cmd.readOnly = true;
  298. cmd.isIncrementalSearchCommand = true;
  299. cmd.scrollIntoView = "animate-cursor";
  300. return cmd;
  301. });
  302. function IncrementalSearchKeyboardHandler(iSearch) {
  303. this.$iSearch = iSearch;
  304. }
  305. oop.inherits(IncrementalSearchKeyboardHandler, HashHandler);
  306. (function () {
  307. this.attach = function (editor) {
  308. var iSearch = this.$iSearch;
  309. HashHandler.call(this, exports.iSearchCommands, editor.commands.platform);
  310. this.$commandExecHandler = editor.commands.on('exec', function (e) {
  311. if (!e.command.isIncrementalSearchCommand)
  312. return iSearch.deactivate();
  313. e.stopPropagation();
  314. e.preventDefault();
  315. var scrollTop = editor.session.getScrollTop();
  316. var result = e.command.exec(iSearch, e.args || {});
  317. editor.renderer.scrollCursorIntoView(null, 0.5);
  318. editor.renderer.animateScrolling(scrollTop);
  319. return result;
  320. });
  321. };
  322. this.detach = function (editor) {
  323. if (!this.$commandExecHandler)
  324. return;
  325. editor.commands.off('exec', this.$commandExecHandler);
  326. delete this.$commandExecHandler;
  327. };
  328. var handleKeyboard$super = this.handleKeyboard;
  329. this.handleKeyboard = function (data, hashId, key, keyCode) {
  330. if (((hashId === 1 /*ctrl*/ || hashId === 8 /*command*/) && key === 'v')
  331. || (hashId === 1 /*ctrl*/ && key === 'y'))
  332. return null;
  333. var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
  334. if (cmd && cmd.command) {
  335. return cmd;
  336. }
  337. if (hashId == -1) {
  338. var extendCmd = this.commands.extendSearchTerm;
  339. if (extendCmd) {
  340. return { command: extendCmd, args: key };
  341. }
  342. }
  343. return false;
  344. };
  345. }).call(IncrementalSearchKeyboardHandler.prototype);
  346. exports.IncrementalSearchKeyboardHandler = IncrementalSearchKeyboardHandler;
  347. });
  348. ace.define("ace/incremental_search",["require","exports","module","ace/range","ace/search","ace/search_highlight","ace/commands/incremental_search_commands","ace/lib/dom","ace/commands/command_manager","ace/editor","ace/config"], function(require, exports, module){"use strict";
  349. var __extends = (this && this.__extends) || (function () {
  350. var extendStatics = function (d, b) {
  351. extendStatics = Object.setPrototypeOf ||
  352. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  353. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  354. return extendStatics(d, b);
  355. };
  356. return function (d, b) {
  357. if (typeof b !== "function" && b !== null)
  358. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  359. extendStatics(d, b);
  360. function __() { this.constructor = d; }
  361. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  362. };
  363. })();
  364. var Range = require("./range").Range;
  365. var Search = require("./search").Search;
  366. var SearchHighlight = require("./search_highlight").SearchHighlight;
  367. var iSearchCommandModule = require("./commands/incremental_search_commands");
  368. var ISearchKbd = iSearchCommandModule.IncrementalSearchKeyboardHandler;
  369. function isRegExp(obj) {
  370. return obj instanceof RegExp;
  371. }
  372. function regExpToObject(re) {
  373. var string = String(re), start = string.indexOf('/'), flagStart = string.lastIndexOf('/');
  374. return {
  375. expression: string.slice(start + 1, flagStart),
  376. flags: string.slice(flagStart + 1)
  377. };
  378. }
  379. function stringToRegExp(string, flags) {
  380. try {
  381. return new RegExp(string, flags);
  382. }
  383. catch (e) {
  384. return string;
  385. }
  386. }
  387. function objectToRegExp(obj) {
  388. return stringToRegExp(obj.expression, obj.flags);
  389. }
  390. var IncrementalSearch = /** @class */ (function (_super) {
  391. __extends(IncrementalSearch, _super);
  392. function IncrementalSearch() {
  393. var _this = _super.call(this) || this;
  394. _this.$options = { wrap: false, skipCurrent: false };
  395. _this.$keyboardHandler = new ISearchKbd(_this);
  396. return _this;
  397. }
  398. IncrementalSearch.prototype.activate = function (editor, backwards) {
  399. this.$editor = editor;
  400. this.$startPos = this.$currentPos = editor.getCursorPosition();
  401. this.$options.needle = '';
  402. this.$options.backwards = backwards;
  403. editor.keyBinding.addKeyboardHandler(this.$keyboardHandler);
  404. this.$originalEditorOnPaste = editor.onPaste;
  405. editor.onPaste = this.onPaste.bind(this);
  406. this.$mousedownHandler = editor.on('mousedown', this.onMouseDown.bind(this));
  407. this.selectionFix(editor);
  408. this.statusMessage(true);
  409. };
  410. IncrementalSearch.prototype.deactivate = function (reset) {
  411. this.cancelSearch(reset);
  412. var editor = this.$editor;
  413. editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler);
  414. if (this.$mousedownHandler) {
  415. editor.off('mousedown', this.$mousedownHandler);
  416. delete this.$mousedownHandler;
  417. }
  418. editor.onPaste = this.$originalEditorOnPaste;
  419. this.message('');
  420. };
  421. IncrementalSearch.prototype.selectionFix = function (editor) {
  422. if (editor.selection.isEmpty() && !editor.session.$emacsMark) {
  423. editor.clearSelection();
  424. }
  425. };
  426. IncrementalSearch.prototype.highlight = function (regexp) {
  427. var sess = this.$editor.session, hl = sess.$isearchHighlight = sess.$isearchHighlight || sess.addDynamicMarker(new SearchHighlight(null, "ace_isearch-result", "text"));
  428. hl.setRegexp(regexp);
  429. sess._emit("changeBackMarker"); // force highlight layer redraw
  430. };
  431. IncrementalSearch.prototype.cancelSearch = function (reset) {
  432. var e = this.$editor;
  433. this.$prevNeedle = this.$options.needle;
  434. this.$options.needle = '';
  435. if (reset) {
  436. e.moveCursorToPosition(this.$startPos);
  437. this.$currentPos = this.$startPos;
  438. }
  439. else {
  440. e.pushEmacsMark && e.pushEmacsMark(this.$startPos, false);
  441. }
  442. this.highlight(null);
  443. return Range.fromPoints(this.$currentPos, this.$currentPos);
  444. };
  445. IncrementalSearch.prototype.highlightAndFindWithNeedle = function (moveToNext, needleUpdateFunc) {
  446. if (!this.$editor)
  447. return null;
  448. var options = this.$options;
  449. if (needleUpdateFunc) {
  450. options.needle = needleUpdateFunc.call(this, options.needle || '') || '';
  451. }
  452. if (options.needle.length === 0) {
  453. this.statusMessage(true);
  454. return this.cancelSearch(true);
  455. }
  456. options.start = this.$currentPos;
  457. var session = this.$editor.session, found = this.find(session), shouldSelect = this.$editor.emacsMark ?
  458. !!this.$editor.emacsMark() : !this.$editor.selection.isEmpty();
  459. if (found) {
  460. if (options.backwards)
  461. found = Range.fromPoints(found.end, found.start);
  462. this.$editor.selection.setRange(Range.fromPoints(shouldSelect ? this.$startPos : found.end, found.end));
  463. if (moveToNext)
  464. this.$currentPos = found.end;
  465. this.highlight(options.re);
  466. }
  467. this.statusMessage(found);
  468. return found;
  469. };
  470. IncrementalSearch.prototype.addString = function (s) {
  471. return this.highlightAndFindWithNeedle(false, function (needle) {
  472. if (!isRegExp(needle))
  473. return needle + s;
  474. var reObj = regExpToObject(needle);
  475. reObj.expression += s;
  476. return objectToRegExp(reObj);
  477. });
  478. };
  479. IncrementalSearch.prototype.removeChar = function (c) {
  480. return this.highlightAndFindWithNeedle(false, function (needle) {
  481. if (!isRegExp(needle))
  482. return needle.substring(0, needle.length - 1);
  483. var reObj = regExpToObject(needle);
  484. reObj.expression = reObj.expression.substring(0, reObj.expression.length - 1);
  485. return objectToRegExp(reObj);
  486. });
  487. };
  488. IncrementalSearch.prototype.next = function (options) {
  489. options = options || {};
  490. this.$options.backwards = !!options.backwards;
  491. this.$currentPos = this.$editor.getCursorPosition();
  492. return this.highlightAndFindWithNeedle(true, function (needle) {
  493. return options.useCurrentOrPrevSearch && needle.length === 0 ?
  494. this.$prevNeedle || '' : needle;
  495. });
  496. };
  497. IncrementalSearch.prototype.onMouseDown = function (evt) {
  498. this.deactivate();
  499. return true;
  500. };
  501. IncrementalSearch.prototype.onPaste = function (text) {
  502. this.addString(text);
  503. };
  504. IncrementalSearch.prototype.convertNeedleToRegExp = function () {
  505. return this.highlightAndFindWithNeedle(false, function (needle) {
  506. return isRegExp(needle) ? needle : stringToRegExp(needle, 'ig');
  507. });
  508. };
  509. IncrementalSearch.prototype.convertNeedleToString = function () {
  510. return this.highlightAndFindWithNeedle(false, function (needle) {
  511. return isRegExp(needle) ? regExpToObject(needle).expression : needle;
  512. });
  513. };
  514. IncrementalSearch.prototype.statusMessage = function (found) {
  515. var options = this.$options, msg = '';
  516. msg += options.backwards ? 'reverse-' : '';
  517. msg += 'isearch: ' + options.needle;
  518. msg += found ? '' : ' (not found)';
  519. this.message(msg);
  520. };
  521. IncrementalSearch.prototype.message = function (msg) {
  522. if (this.$editor.showCommandLine) {
  523. this.$editor.showCommandLine(msg);
  524. this.$editor.focus();
  525. }
  526. };
  527. return IncrementalSearch;
  528. }(Search));
  529. exports.IncrementalSearch = IncrementalSearch;
  530. var dom = require('./lib/dom');
  531. dom.importCssString("\n.ace_marker-layer .ace_isearch-result {\n position: absolute;\n z-index: 6;\n box-sizing: border-box;\n}\ndiv.ace_isearch-result {\n border-radius: 4px;\n background-color: rgba(255, 200, 0, 0.5);\n box-shadow: 0 0 4px rgb(255, 200, 0);\n}\n.ace_dark div.ace_isearch-result {\n background-color: rgb(100, 110, 160);\n box-shadow: 0 0 4px rgb(80, 90, 140);\n}", "incremental-search-highlighting", false);
  532. var commands = require("./commands/command_manager");
  533. (function () {
  534. this.setupIncrementalSearch = function (editor, val) {
  535. if (this.usesIncrementalSearch == val)
  536. return;
  537. this.usesIncrementalSearch = val;
  538. var iSearchCommands = iSearchCommandModule.iSearchStartCommands;
  539. var method = val ? 'addCommands' : 'removeCommands';
  540. this[method](iSearchCommands);
  541. };
  542. }).call(commands.CommandManager.prototype);
  543. var Editor = require("./editor").Editor;
  544. require("./config").defineOptions(Editor.prototype, "editor", {
  545. useIncrementalSearch: {
  546. set: function (val) {
  547. this.keyBinding.$handlers.forEach(function (handler) {
  548. if (handler.setupIncrementalSearch) {
  549. handler.setupIncrementalSearch(this, val);
  550. }
  551. });
  552. this._emit('incrementalSearchSettingChanged', { isEnabled: val });
  553. }
  554. }
  555. });
  556. });
  557. ace.define("ace/keyboard/emacs",["require","exports","module","ace/lib/dom","ace/incremental_search","ace/commands/incremental_search_commands","ace/keyboard/hash_handler","ace/lib/keys"], function(require, exports, module){"use strict";
  558. var dom = require("../lib/dom");
  559. require("../incremental_search");
  560. var iSearchCommandModule = require("../commands/incremental_search_commands");
  561. var HashHandler = require("./hash_handler").HashHandler;
  562. exports.handler = new HashHandler();
  563. exports.handler.isEmacs = true;
  564. exports.handler.$id = "ace/keyboard/emacs";
  565. dom.importCssString("\n.emacs-mode .ace_cursor{\n border: 1px rgba(50,250,50,0.8) solid!important;\n box-sizing: border-box!important;\n background-color: rgba(0,250,0,0.9);\n opacity: 0.5;\n}\n.emacs-mode .ace_hidden-cursors .ace_cursor{\n opacity: 1;\n background-color: transparent;\n}\n.emacs-mode .ace_overwrite-cursors .ace_cursor {\n opacity: 1;\n background-color: transparent;\n border-width: 0 0 2px 2px !important;\n}\n.emacs-mode .ace_text-layer {\n z-index: 4\n}\n.emacs-mode .ace_cursor-layer {\n z-index: 2\n}", 'emacsMode');
  566. var $formerLongWords;
  567. var $formerLineStart;
  568. exports.handler.attach = function (editor) {
  569. $formerLongWords = editor.session.$selectLongWords;
  570. editor.session.$selectLongWords = true;
  571. $formerLineStart = editor.session.$useEmacsStyleLineStart;
  572. editor.session.$useEmacsStyleLineStart = true;
  573. editor.session.$emacsMark = null; // the active mark
  574. editor.session.$emacsMarkRing = editor.session.$emacsMarkRing || [];
  575. editor.emacsMark = function () {
  576. return this.session.$emacsMark;
  577. };
  578. editor.setEmacsMark = function (p) {
  579. this.session.$emacsMark = p;
  580. };
  581. editor.pushEmacsMark = function (p, activate) {
  582. var prevMark = this.session.$emacsMark;
  583. if (prevMark)
  584. pushUnique(this.session.$emacsMarkRing, prevMark);
  585. if (!p || activate)
  586. this.setEmacsMark(p);
  587. else
  588. pushUnique(this.session.$emacsMarkRing, p);
  589. };
  590. editor.popEmacsMark = function () {
  591. var mark = this.emacsMark();
  592. if (mark) {
  593. this.setEmacsMark(null);
  594. return mark;
  595. }
  596. return this.session.$emacsMarkRing.pop();
  597. };
  598. editor.getLastEmacsMark = function (p) {
  599. return this.session.$emacsMark || this.session.$emacsMarkRing.slice(-1)[0];
  600. };
  601. editor.emacsMarkForSelection = function (replacement) {
  602. var sel = this.selection, multiRangeLength = this.multiSelect ?
  603. this.multiSelect.getAllRanges().length : 1, selIndex = sel.index || 0, markRing = this.session.$emacsMarkRing, markIndex = markRing.length - (multiRangeLength - selIndex), lastMark = markRing[markIndex] || sel.anchor;
  604. if (replacement) {
  605. markRing.splice(markIndex, 1, "row" in replacement && "column" in replacement ?
  606. replacement : undefined);
  607. }
  608. return lastMark;
  609. };
  610. editor.on("click", $resetMarkMode);
  611. editor.on("changeSession", $kbSessionChange);
  612. editor.renderer.$blockCursor = true;
  613. editor.setStyle("emacs-mode");
  614. editor.commands.addCommands(commands);
  615. exports.handler.platform = editor.commands.platform;
  616. editor.$emacsModeHandler = this;
  617. editor.on('copy', this.onCopy);
  618. editor.on('paste', this.onPaste);
  619. };
  620. function pushUnique(ring, mark) {
  621. var last = ring[ring.length - 1];
  622. if (last && last.row === mark.row && last.column === mark.column) {
  623. return;
  624. }
  625. ring.push(mark);
  626. }
  627. exports.handler.detach = function (editor) {
  628. editor.renderer.$blockCursor = false;
  629. editor.session.$selectLongWords = $formerLongWords;
  630. editor.session.$useEmacsStyleLineStart = $formerLineStart;
  631. editor.off("click", $resetMarkMode);
  632. editor.off("changeSession", $kbSessionChange);
  633. editor.unsetStyle("emacs-mode");
  634. editor.commands.removeCommands(commands);
  635. editor.off('copy', this.onCopy);
  636. editor.off('paste', this.onPaste);
  637. editor.$emacsModeHandler = null;
  638. };
  639. var $kbSessionChange = function (e) {
  640. if (e.oldSession) {
  641. e.oldSession.$selectLongWords = $formerLongWords;
  642. e.oldSession.$useEmacsStyleLineStart = $formerLineStart;
  643. }
  644. $formerLongWords = e.session.$selectLongWords;
  645. e.session.$selectLongWords = true;
  646. $formerLineStart = e.session.$useEmacsStyleLineStart;
  647. e.session.$useEmacsStyleLineStart = true;
  648. if (!e.session.hasOwnProperty('$emacsMark'))
  649. e.session.$emacsMark = null;
  650. if (!e.session.hasOwnProperty('$emacsMarkRing'))
  651. e.session.$emacsMarkRing = [];
  652. };
  653. var $resetMarkMode = function (e) {
  654. e.editor.session.$emacsMark = null;
  655. };
  656. var keys = require("../lib/keys").KEY_MODS;
  657. var eMods = { C: "ctrl", S: "shift", M: "alt", CMD: "command" };
  658. var combinations = ["C-S-M-CMD",
  659. "S-M-CMD", "C-M-CMD", "C-S-CMD", "C-S-M",
  660. "M-CMD", "S-CMD", "S-M", "C-CMD", "C-M", "C-S",
  661. "CMD", "M", "S", "C"];
  662. combinations.forEach(function (c) {
  663. var hashId = 0;
  664. c.split("-").forEach(function (c) {
  665. hashId = hashId | keys[eMods[c]];
  666. });
  667. eMods[hashId] = c.toLowerCase() + "-";
  668. });
  669. exports.handler.onCopy = function (e, editor) {
  670. if (editor.$handlesEmacsOnCopy)
  671. return;
  672. editor.$handlesEmacsOnCopy = true;
  673. exports.handler.commands.killRingSave.exec(editor);
  674. editor.$handlesEmacsOnCopy = false;
  675. };
  676. exports.handler.onPaste = function (e, editor) {
  677. editor.pushEmacsMark(editor.getCursorPosition());
  678. };
  679. exports.handler.bindKey = function (key, command) {
  680. if (typeof key == "object")
  681. key = key[this.platform];
  682. if (!key)
  683. return;
  684. var ckb = this.commandKeyBinding;
  685. key.split("|").forEach(function (keyPart) {
  686. keyPart = keyPart.toLowerCase();
  687. ckb[keyPart] = command;
  688. var keyParts = keyPart.split(" ").slice(0, -1);
  689. keyParts.reduce(function (keyMapKeys, keyPart, i) {
  690. var prefix = keyMapKeys[i - 1] ? keyMapKeys[i - 1] + ' ' : '';
  691. return keyMapKeys.concat([prefix + keyPart]);
  692. }, []).forEach(function (keyPart) {
  693. if (!ckb[keyPart])
  694. ckb[keyPart] = "null";
  695. });
  696. }, this);
  697. };
  698. exports.handler.getStatusText = function (editor, data) {
  699. var str = "";
  700. if (data.count)
  701. str += data.count;
  702. if (data.keyChain)
  703. str += " " + data.keyChain;
  704. return str;
  705. };
  706. exports.handler.handleKeyboard = function (data, hashId, key, keyCode) {
  707. if (keyCode === -1)
  708. return undefined;
  709. var editor = data.editor;
  710. editor._signal("changeStatus");
  711. if (hashId == -1) {
  712. editor.pushEmacsMark();
  713. if (data.count) {
  714. var str = new Array(data.count + 1).join(key);
  715. data.count = null;
  716. return { command: "insertstring", args: str };
  717. }
  718. }
  719. var modifier = eMods[hashId];
  720. if (modifier == "c-" || data.count) {
  721. var count = parseInt(key[key.length - 1]);
  722. if (typeof count === 'number' && !isNaN(count)) {
  723. data.count = Math.max(data.count, 0) || 0;
  724. data.count = 10 * data.count + count;
  725. return { command: "null" };
  726. }
  727. }
  728. if (modifier)
  729. key = modifier + key;
  730. if (data.keyChain)
  731. key = data.keyChain += " " + key;
  732. var command = this.commandKeyBinding[key];
  733. data.keyChain = command == "null" ? key : "";
  734. if (!command)
  735. return undefined;
  736. if (command === "null")
  737. return { command: "null" };
  738. if (command === "universalArgument") {
  739. data.count = -4;
  740. return { command: "null" };
  741. }
  742. var args;
  743. if (typeof command !== "string") {
  744. args = command.args;
  745. if (command.command)
  746. command = command.command;
  747. if (command === "goorselect") {
  748. command = editor.emacsMark() ? args[1] : args[0];
  749. args = null;
  750. }
  751. }
  752. if (typeof command === "string") {
  753. if (command === "insertstring" ||
  754. command === "splitline" ||
  755. command === "togglecomment") {
  756. editor.pushEmacsMark();
  757. }
  758. command = this.commands[command] || editor.commands.commands[command];
  759. if (!command)
  760. return undefined;
  761. }
  762. if (!command.readOnly && !command.isYank)
  763. data.lastCommand = null;
  764. if (!command.readOnly && editor.emacsMark())
  765. editor.setEmacsMark(null);
  766. if (data.count) {
  767. var count = data.count;
  768. data.count = 0;
  769. if (!command || !command.handlesCount) {
  770. return {
  771. args: args,
  772. command: {
  773. exec: function (editor, args) {
  774. for (var i = 0; i < count; i++)
  775. command.exec(editor, args);
  776. },
  777. multiSelectAction: command.multiSelectAction
  778. }
  779. };
  780. }
  781. else {
  782. if (!args)
  783. args = {};
  784. if (typeof args === 'object')
  785. args.count = count;
  786. }
  787. }
  788. return { command: command, args: args };
  789. };
  790. exports.emacsKeys = {
  791. "Up|C-p": { command: "goorselect", args: ["golineup", "selectup"] },
  792. "Down|C-n": { command: "goorselect", args: ["golinedown", "selectdown"] },
  793. "Left|C-b": { command: "goorselect", args: ["gotoleft", "selectleft"] },
  794. "Right|C-f": { command: "goorselect", args: ["gotoright", "selectright"] },
  795. "C-Left|M-b": { command: "goorselect", args: ["gotowordleft", "selectwordleft"] },
  796. "C-Right|M-f": { command: "goorselect", args: ["gotowordright", "selectwordright"] },
  797. "Home|C-a": { command: "goorselect", args: ["gotolinestart", "selecttolinestart"] },
  798. "End|C-e": { command: "goorselect", args: ["gotolineend", "selecttolineend"] },
  799. "C-Home|S-M-,": { command: "goorselect", args: ["gotostart", "selecttostart"] },
  800. "C-End|S-M-.": { command: "goorselect", args: ["gotoend", "selecttoend"] },
  801. "S-Up|S-C-p": "selectup",
  802. "S-Down|S-C-n": "selectdown",
  803. "S-Left|S-C-b": "selectleft",
  804. "S-Right|S-C-f": "selectright",
  805. "S-C-Left|S-M-b": "selectwordleft",
  806. "S-C-Right|S-M-f": "selectwordright",
  807. "S-Home|S-C-a": "selecttolinestart",
  808. "S-End|S-C-e": "selecttolineend",
  809. "S-C-Home": "selecttostart",
  810. "S-C-End": "selecttoend",
  811. "C-l": "recenterTopBottom",
  812. "M-s": "centerselection",
  813. "M-g": "gotoline",
  814. "C-x C-p": "selectall",
  815. "C-Down": { command: "goorselect", args: ["gotopagedown", "selectpagedown"] },
  816. "C-Up": { command: "goorselect", args: ["gotopageup", "selectpageup"] },
  817. "PageDown|C-v": { command: "goorselect", args: ["gotopagedown", "selectpagedown"] },
  818. "PageUp|M-v": { command: "goorselect", args: ["gotopageup", "selectpageup"] },
  819. "S-C-Down": "selectpagedown",
  820. "S-C-Up": "selectpageup",
  821. "C-s": "iSearch",
  822. "C-r": "iSearchBackwards",
  823. "M-C-s": "findnext",
  824. "M-C-r": "findprevious",
  825. "S-M-5": "replace",
  826. "Backspace": "backspace",
  827. "Delete|C-d": "del",
  828. "Return|C-m": { command: "insertstring", args: "\n" }, // "newline"
  829. "C-o": "splitline",
  830. "M-d|C-Delete": { command: "killWord", args: "right" },
  831. "C-Backspace|M-Backspace|M-Delete": { command: "killWord", args: "left" },
  832. "C-k": "killLine",
  833. "C-y|S-Delete": "yank",
  834. "M-y": "yankRotate",
  835. "C-g": "keyboardQuit",
  836. "C-w|C-S-W": "killRegion",
  837. "M-w": "killRingSave",
  838. "C-Space": "setMark",
  839. "C-x C-x": "exchangePointAndMark",
  840. "C-t": "transposeletters",
  841. "M-u": "touppercase", // Doesn't work
  842. "M-l": "tolowercase",
  843. "M-/": "autocomplete", // Doesn't work
  844. "C-u": "universalArgument",
  845. "M-;": "togglecomment",
  846. "C-/|C-x u|S-C--|C-z": "undo",
  847. "S-C-/|S-C-x u|C--|S-C-z": "redo", // infinite undo?
  848. "C-x r": "selectRectangularRegion",
  849. "M-x": { command: "focusCommandLine", args: "M-x " }
  850. };
  851. exports.handler.bindKeys(exports.emacsKeys);
  852. exports.handler.addCommands({
  853. recenterTopBottom: function (editor) {
  854. var renderer = editor.renderer;
  855. var pos = renderer.$cursorLayer.getPixelPosition();
  856. var h = renderer.$size.scrollerHeight - renderer.lineHeight;
  857. var scrollTop = renderer.scrollTop;
  858. if (Math.abs(pos.top - scrollTop) < 2) {
  859. scrollTop = pos.top - h;
  860. }
  861. else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) {
  862. scrollTop = pos.top;
  863. }
  864. else {
  865. scrollTop = pos.top - h * 0.5;
  866. }
  867. editor.session.setScrollTop(scrollTop);
  868. },
  869. selectRectangularRegion: function (editor) {
  870. editor.multiSelect.toggleBlockSelection();
  871. },
  872. setMark: {
  873. exec: function (editor, args) {
  874. if (args && args.count) {
  875. if (editor.inMultiSelectMode)
  876. editor.forEachSelection(moveToMark);
  877. else
  878. moveToMark();
  879. moveToMark();
  880. return;
  881. }
  882. var mark = editor.emacsMark(), ranges = editor.selection.getAllRanges(), rangePositions = ranges.map(function (r) { return { row: r.start.row, column: r.start.column }; }), transientMarkModeActive = true, hasNoSelection = ranges.every(function (range) { return range.isEmpty(); });
  883. if (transientMarkModeActive && (mark || !hasNoSelection)) {
  884. if (editor.inMultiSelectMode)
  885. editor.forEachSelection({ exec: editor.clearSelection.bind(editor) });
  886. else
  887. editor.clearSelection();
  888. if (mark)
  889. editor.pushEmacsMark(null);
  890. return;
  891. }
  892. if (!mark) {
  893. rangePositions.forEach(function (pos) { editor.pushEmacsMark(pos); });
  894. editor.setEmacsMark(rangePositions[rangePositions.length - 1]);
  895. return;
  896. }
  897. function moveToMark() {
  898. var mark = editor.popEmacsMark();
  899. mark && editor.moveCursorToPosition(mark);
  900. }
  901. },
  902. readOnly: true,
  903. handlesCount: true
  904. },
  905. exchangePointAndMark: {
  906. exec: function exchangePointAndMark$exec(editor, args) {
  907. var sel = editor.selection;
  908. if (!args.count && !sel.isEmpty()) { // just invert selection
  909. sel.setSelectionRange(sel.getRange(), !sel.isBackwards());
  910. return;
  911. }
  912. if (args.count) { // replace mark and point
  913. var pos = { row: sel.lead.row, column: sel.lead.column };
  914. sel.clearSelection();
  915. sel.moveCursorToPosition(editor.emacsMarkForSelection(pos));
  916. }
  917. else { // create selection to last mark
  918. sel.selectToPosition(editor.emacsMarkForSelection());
  919. }
  920. },
  921. readOnly: true,
  922. handlesCount: true,
  923. multiSelectAction: "forEach"
  924. },
  925. killWord: {
  926. exec: function (editor, dir) {
  927. editor.clearSelection();
  928. if (dir == "left")
  929. editor.selection.selectWordLeft();
  930. else
  931. editor.selection.selectWordRight();
  932. var range = editor.getSelectionRange();
  933. var text = editor.session.getTextRange(range);
  934. exports.killRing.add(text);
  935. editor.session.remove(range);
  936. editor.clearSelection();
  937. },
  938. multiSelectAction: "forEach"
  939. },
  940. killLine: function (editor) {
  941. editor.pushEmacsMark(null);
  942. editor.clearSelection();
  943. var range = editor.getSelectionRange();
  944. var line = editor.session.getLine(range.start.row);
  945. range.end.column = line.length;
  946. line = line.substr(range.start.column);
  947. var foldLine = editor.session.getFoldLine(range.start.row);
  948. if (foldLine && range.end.row != foldLine.end.row) {
  949. range.end.row = foldLine.end.row;
  950. line = "x";
  951. }
  952. if (/^\s*$/.test(line)) {
  953. range.end.row++;
  954. line = editor.session.getLine(range.end.row);
  955. range.end.column = /^\s*$/.test(line) ? line.length : 0;
  956. }
  957. var text = editor.session.getTextRange(range);
  958. if (editor.prevOp.command == this)
  959. exports.killRing.append(text);
  960. else
  961. exports.killRing.add(text);
  962. editor.session.remove(range);
  963. editor.clearSelection();
  964. },
  965. yank: function (editor) {
  966. editor.onPaste(exports.killRing.get() || '');
  967. editor.keyBinding.$data.lastCommand = "yank";
  968. },
  969. yankRotate: function (editor) {
  970. if (editor.keyBinding.$data.lastCommand != "yank")
  971. return;
  972. editor.undo();
  973. editor.session.$emacsMarkRing.pop(); // also undo recording mark
  974. editor.onPaste(exports.killRing.rotate());
  975. editor.keyBinding.$data.lastCommand = "yank";
  976. },
  977. killRegion: {
  978. exec: function (editor) {
  979. exports.killRing.add(editor.getCopyText());
  980. editor.commands.byName.cut.exec(editor);
  981. editor.setEmacsMark(null);
  982. },
  983. readOnly: true,
  984. multiSelectAction: "forEach"
  985. },
  986. killRingSave: {
  987. exec: function (editor) {
  988. editor.$handlesEmacsOnCopy = true;
  989. var marks = editor.session.$emacsMarkRing.slice(), deselectedMarks = [];
  990. exports.killRing.add(editor.getCopyText());
  991. setTimeout(function () {
  992. function deselect() {
  993. var sel = editor.selection, range = sel.getRange(), pos = sel.isBackwards() ? range.end : range.start;
  994. deselectedMarks.push({ row: pos.row, column: pos.column });
  995. sel.clearSelection();
  996. }
  997. editor.$handlesEmacsOnCopy = false;
  998. if (editor.inMultiSelectMode)
  999. editor.forEachSelection({ exec: deselect });
  1000. else
  1001. deselect();
  1002. editor.setEmacsMark(null);
  1003. editor.session.$emacsMarkRing = marks.concat(deselectedMarks.reverse());
  1004. }, 0);
  1005. },
  1006. readOnly: true
  1007. },
  1008. keyboardQuit: function (editor) {
  1009. editor.selection.clearSelection();
  1010. editor.setEmacsMark(null);
  1011. editor.keyBinding.$data.count = null;
  1012. },
  1013. focusCommandLine: function (editor, arg) {
  1014. if (editor.showCommandLine)
  1015. editor.showCommandLine(arg);
  1016. }
  1017. });
  1018. exports.handler.addCommands(iSearchCommandModule.iSearchStartCommands);
  1019. var commands = exports.handler.commands;
  1020. commands.yank.isYank = true;
  1021. commands.yankRotate.isYank = true;
  1022. exports.killRing = {
  1023. $data: [],
  1024. add: function (str) {
  1025. str && this.$data.push(str);
  1026. if (this.$data.length > 30)
  1027. this.$data.shift();
  1028. },
  1029. append: function (str) {
  1030. var idx = this.$data.length - 1;
  1031. var text = this.$data[idx] || "";
  1032. if (str)
  1033. text += str;
  1034. if (text)
  1035. this.$data[idx] = text;
  1036. },
  1037. get: function (n) {
  1038. n = n || 1;
  1039. return this.$data.slice(this.$data.length - n, this.$data.length).reverse().join('\n');
  1040. },
  1041. pop: function () {
  1042. if (this.$data.length > 1)
  1043. this.$data.pop();
  1044. return this.get();
  1045. },
  1046. rotate: function () {
  1047. this.$data.unshift(this.$data.pop());
  1048. return this.get();
  1049. }
  1050. };
  1051. }); (function() {
  1052. ace.require(["ace/keyboard/emacs"], function(m) {
  1053. if (typeof module == "object" && typeof exports == "object" && module) {
  1054. module.exports = m;
  1055. }
  1056. });
  1057. })();