summaryrefslogtreecommitdiff
path: root/public/vendor/codemirror/addon/hint
diff options
context:
space:
mode:
Diffstat (limited to 'public/vendor/codemirror/addon/hint')
-rw-r--r--public/vendor/codemirror/addon/hint/show-hint.css1
-rw-r--r--public/vendor/codemirror/addon/hint/show-hint.js3
-rw-r--r--public/vendor/codemirror/addon/hint/sql-hint.js22
3 files changed, 8 insertions, 18 deletions
diff --git a/public/vendor/codemirror/addon/hint/show-hint.css b/public/vendor/codemirror/addon/hint/show-hint.css
index 453dee4b..5617ccca 100644
--- a/public/vendor/codemirror/addon/hint/show-hint.css
+++ b/public/vendor/codemirror/addon/hint/show-hint.css
@@ -16,7 +16,6 @@
background: white;
font-size: 90%;
font-family: monospace;
- max-width: 19em;
max-height: 20em;
overflow-y: auto;
diff --git a/public/vendor/codemirror/addon/hint/show-hint.js b/public/vendor/codemirror/addon/hint/show-hint.js
index 64ec9289..604bd3b7 100644
--- a/public/vendor/codemirror/addon/hint/show-hint.js
+++ b/public/vendor/codemirror/addon/hint/show-hint.js
@@ -230,6 +230,8 @@
(completion.options.container || document.body).appendChild(hints);
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
var scrolls = hints.scrollHeight > hints.clientHeight + 1
+ var startScroll = cm.getScrollInfo();
+
if (overlapY > 0) {
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
if (curTop - height > 0) { // Fits above cursor
@@ -273,7 +275,6 @@
cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
}
- var startScroll = cm.getScrollInfo();
cm.on("scroll", this.onScroll = function() {
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
var newTop = top + startScroll.top - curScroll.top;
diff --git a/public/vendor/codemirror/addon/hint/sql-hint.js b/public/vendor/codemirror/addon/hint/sql-hint.js
index ed8f6d85..1ee4f0bb 100644
--- a/public/vendor/codemirror/addon/hint/sql-hint.js
+++ b/public/vendor/codemirror/addon/hint/sql-hint.js
@@ -18,7 +18,7 @@
QUERY_DIV: ";",
ALIAS_KEYWORD: "AS"
};
- var Pos = CodeMirror.Pos;
+ var Pos = CodeMirror.Pos, cmpPos = CodeMirror.cmpPos;
function isArray(val) { return Object.prototype.toString.call(val) == "[object Array]" }
@@ -178,15 +178,6 @@
}
}
- function convertCurToNumber(cur) {
- // max characters of a line is 999,999.
- return cur.line + cur.ch / Math.pow(10, 6);
- }
-
- function convertNumberToCur(num) {
- return Pos(Math.floor(num), +num.toString().split('.').pop());
- }
-
function findTableByAlias(alias, editor) {
var doc = editor.doc;
var fullQuery = doc.getValue();
@@ -209,15 +200,14 @@
separator.push(Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).text.length));
//find valid range
- var prevItem = 0;
- var current = convertCurToNumber(editor.getCursor());
+ var prevItem = null;
+ var current = editor.getCursor()
for (var i = 0; i < separator.length; i++) {
- var _v = convertCurToNumber(separator[i]);
- if (current > prevItem && current <= _v) {
- validRange = { start: convertNumberToCur(prevItem), end: convertNumberToCur(_v) };
+ if ((prevItem == null || cmpPos(current, prevItem) > 0) && cmpPos(current, separator[i]) <= 0) {
+ validRange = {start: prevItem, end: separator[i]};
break;
}
- prevItem = _v;
+ prevItem = separator[i];
}
var query = doc.getRange(validRange.start, validRange.end, false);