vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js in codemirror-rails-4.8 vs vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js in codemirror-rails-4.9
- old
+ new
@@ -16,13 +16,12 @@
function getHints(cm, options) {
var tags = options && options.schemaInfo;
var quote = (options && options.quoteChar) || '"';
if (!tags) return;
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
- if (/^<\/?$/.test(token.string) && token.end == cur.ch) {
- var nextToken = cm.getTokenAt(Pos(cur.line, cur.ch + 1));
- if (nextToken.start == cur.ch && /\btag\b/.test(nextToken.type))
- token = nextToken;
+ if (token.end > cur.ch) {
+ token.end = cur.ch;
+ token.string = token.string.slice(0, cur.ch - token.start);
}
var inner = CodeMirror.innerMode(cm.getMode(), token.state);
if (inner.mode.name != "xml") return;
var result = [], replaceToken = false, prefix;
var tag = /\btag\b/.test(token.type) && !/>$/.test(token.string);