Skip to content

Commit

Permalink
Adjust hint.fromList to consistenly use the cursor as end pos
Browse files Browse the repository at this point in the history
Issue #5312
  • Loading branch information
marijnh committed Mar 20, 2018
1 parent e732d0e commit d49ef29
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,13 @@
});

CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
var to = CodeMirror.Pos(cur.line, token.end);
if (token.string && /\w/.test(token.string[token.string.length - 1])) {
var length = token.string.length - (token.end - cur.ch);
var term = token.string.substr(0, length), from = CodeMirror.Pos(cur.line, token.start);
var cur = cm.getCursor(), token = cm.getTokenAt(cur)
var term, from = CodeMirror.Pos(cur.line, token.start), to = cur
if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) {
term = token.string.substr(0, cur.ch - token.start)
} else {
var term = "", from = to;
term = ""
from = cur
}
var found = [];
for (var i = 0; i < options.words.length; i++) {
Expand Down

0 comments on commit d49ef29

Please sign in to comment.