Merge pull request #77 from sharelatex/ns-autocomplete-insertion-bug

fix autocomplete insertion on single backslash; Fixes #55
This commit is contained in:
Alasdair Smith 2017-11-20 15:20:45 +00:00 committed by GitHub
commit 1a8a915116
2 changed files with 3 additions and 2 deletions

View file

@ -229,6 +229,7 @@ define [
99999 99999
) )
) )
if lineBeyondCursor if lineBeyondCursor
if partialCommandMatch = lineBeyondCursor.match(/^([a-zA-Z0-9]+)\{/) if partialCommandMatch = lineBeyondCursor.match(/^([a-zA-Z0-9]+)\{/)
# We've got a partial command after the cursor # We've got a partial command after the cursor

View file

@ -17,8 +17,8 @@ define [
# \includegraphics[width=\textwidth]{.. # \includegraphics[width=\textwidth]{..
# should not match the \textwidth. # should not match the \textwidth.
blankArguments = lineUpToCursor.replace /\[([^\]]*)\]/g, (args) -> blankArguments = lineUpToCursor.replace /\[([^\]]*)\]/g, (args) ->
Array(args.length+1).join('.') Array(args.length + 1).join('.')
if m = blankArguments.match(/(\\[^\\]+)$/) if m = blankArguments.match(/(\\[^\\]*)$/)
return m.index return m.index
else else
return -1 return -1