vendor/assets/javascripts/ace/ext-language_tools.js in ace-rails-ap-4.0.0 vs vendor/assets/javascripts/ace/ext-language_tools.js in ace-rails-ap-4.0.1
- old
+ new
@@ -500,11 +500,14 @@
if (s.tabTrigger && !s.trigger) {
if (!s.guard && /^\w/.test(s.tabTrigger))
s.guard = "\\b";
s.trigger = lang.escapeRegExp(s.tabTrigger);
}
-
+
+ if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)
+ return;
+
s.startRe = guardedRegexp(s.trigger, s.guard, true);
s.triggerRe = new RegExp(s.trigger, "", true);
s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
s.endTriggerRe = new RegExp(s.endTrigger, "", true);
@@ -622,15 +625,15 @@
this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
this.editor.tabstopManager = null;
this.editor = null;
};
- this.onChange = function(e) {
- var changeRange = e.data.range;
- var isRemove = e.data.action[0] == "r";
- var start = changeRange.start;
- var end = changeRange.end;
+ this.onChange = function(delta) {
+ var changeRange = delta;
+ var isRemove = delta.action[0] == "r";
+ var start = delta.start;
+ var end = delta.end;
var startRow = start.row;
var endRow = end.row;
var lineDif = endRow - startRow;
var colDiff = end.column - start.column;
@@ -899,14 +902,13 @@
};
}).call(Editor.prototype);
});
-define("ace/autocomplete/popup",["require","exports","module","ace/edit_session","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom"], function(require, exports, module) {
+define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom"], function(require, exports, module) {
"use strict";
-var EditSession = require("../edit_session").EditSession;
var Renderer = require("../virtual_renderer").VirtualRenderer;
var Editor = require("../editor").Editor;
var Range = require("../range").Range;
var event = require("../lib/event");
var lang = require("../lib/lang");
@@ -1088,12 +1090,12 @@
popup.isOpen = false;
popup.isTopdown = false;
popup.data = [];
popup.setData = function(list) {
- popup.data = list || [];
popup.setValue(lang.stringRepeat("\n", list.length), -1);
+ popup.data = list || [];
popup.setRow(0);
};
popup.getData = function(row) {
return popup.data[row];
};
@@ -1327,11 +1329,11 @@
pos.left -= this.popup.getTextLeftOffset();
var rect = editor.container.getBoundingClientRect();
pos.top += rect.top - renderer.layerConfig.offset;
pos.left += rect.left - editor.renderer.scrollLeft;
- pos.left += renderer.$gutterLayer.gutterWidth;
+ pos.left += renderer.gutterWidth;
this.popup.show(pos, lineHeight);
} else if (keepPopupPosition && !prefix) {
this.detach();
}
@@ -1367,14 +1369,15 @@
this.detach();
};
this.blurListener = function(e) {
var el = document.activeElement;
- var text = this.editor.textInput.getElement()
- if (el != text && ( !this.popup || el.parentNode != this.popup.container )
- && el != this.tooltipNode && e.relatedTarget != this.tooltipNode
- && e.relatedTarget != text
+ var text = this.editor.textInput.getElement();
+ var fromTooltip = e.relatedTarget && e.relatedTarget == this.tooltipNode;
+ var container = this.popup && this.popup.container;
+ if (el != text && el.parentNode != container && !fromTooltip
+ && el != this.tooltipNode && e.relatedTarget != text
) {
this.detach();
}
};
@@ -1398,11 +1401,11 @@
}
this.popup.setRow(row);
};
- this.insertMatch = function(data) {
+ this.insertMatch = function(data, options) {
if (!data)
data = this.popup.getData(this.popup.getRow());
if (!data)
return false;
@@ -1431,11 +1434,11 @@
"Ctrl-Up|Ctrl-Home": function(editor) { editor.completer.goTo("start"); },
"Ctrl-Down|Ctrl-End": function(editor) { editor.completer.goTo("end"); },
"Esc": function(editor) { editor.completer.detach(); },
"Return": function(editor) { return editor.completer.insertMatch(); },
- "Shift-Return": function(editor) { editor.completer.insertMatch(true); },
+ "Shift-Return": function(editor) { editor.completer.insertMatch(null, {deleteSuffix: true}); },
"Tab": function(editor) {
var result = editor.completer.insertMatch();
if (!result && !editor.tabstopManager)
editor.completer.goTo("down");
else
@@ -1562,11 +1565,11 @@
});
if (!doc)
doc = selected;
if (typeof doc == "string")
- doc = {docText: doc}
+ doc = {docText: doc};
if (!doc || !(doc.docHTML || doc.docText))
return this.hideDocTooltip();
this.showDocTooltip(doc);
};
@@ -1628,11 +1631,11 @@
editor.completer.cancelContextMenu();
},
bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
};
-var FilteredList = function(array, filterText, mutateData) {
+var FilteredList = function(array, filterText) {
this.all = array;
this.filtered = array;
this.filterText = filterText || "";
this.exactMatch = false;
};
@@ -1868,10 +1871,9 @@
return prefix || util.retrievePrecedingIdentifier(line, pos.column);
}
var doLiveAutocomplete = function(e) {
var editor = e.editor;
- var text = e.args || "";
var hasCompleter = editor.completer && editor.completer.activated;
if (e.command.name === "backspace") {
if (hasCompleter && !getCompletionPrefix(editor))
editor.completer.detach();
}
\ No newline at end of file