From 8bf516263c6582771e7576e8484ca8cfaa8cb9cb Mon Sep 17 00:00:00 2001 From: Cheng-Han, Wu Date: Wed, 20 Apr 2016 18:11:40 +0800 Subject: Update CodeMirror to 5.13.5 --- public/vendor/codemirror/addon/hint/show-hint.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'public/vendor/codemirror/addon/hint/show-hint.js') diff --git a/public/vendor/codemirror/addon/hint/show-hint.js b/public/vendor/codemirror/addon/hint/show-hint.js index cbe3b39a..7661f6c2 100644 --- a/public/vendor/codemirror/addon/hint/show-hint.js +++ b/public/vendor/codemirror/addon/hint/show-hint.js @@ -121,11 +121,13 @@ finishUpdate: function(data, first) { if (this.data) CodeMirror.signal(this.data, "update"); - if (data && this.data && CodeMirror.cmpPos(data.from, this.data.from)) data = null; - this.data = data; var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle); if (this.widget) this.widget.close(); + + if (data && this.data && isNewCompletion(this.data, data)) return; + this.data = data; + if (data && data.list.length) { if (picked && data.list.length == 1) { this.pick(data, 0); @@ -137,6 +139,11 @@ } }; + function isNewCompletion(old, nw) { + var moved = CodeMirror.cmpPos(nw.from, old.from) + return moved > 0 && old.to.ch - old.from.ch != nw.to.ch - nw.from.ch + } + function parseOptions(cm, pos, options) { var editor = cm.options.hintOptions; var out = {}; -- cgit v1.2.3