mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #179 from sharelatex/ns-startsWith-fix
removing `startsWith` calls
This commit is contained in:
commit
d958d8c140
2 changed files with 5 additions and 5 deletions
|
@ -29,7 +29,7 @@ define () ->
|
||||||
|
|
||||||
packageSnippets.push {
|
packageSnippets.push {
|
||||||
caption: "\\usepackage{}"
|
caption: "\\usepackage{}"
|
||||||
snippet: "\\usepackage{}"
|
snippet: "\\usepackage{$1}"
|
||||||
meta: "pkg"
|
meta: "pkg"
|
||||||
score: 70
|
score: 70
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ define [
|
||||||
end = change.end
|
end = change.end
|
||||||
range = new Range(end.row, 0, end.row, end.column)
|
range = new Range(end.row, 0, end.row, end.column)
|
||||||
lineUpToCursor = @editor.getSession().getTextRange range
|
lineUpToCursor = @editor.getSession().getTextRange range
|
||||||
if lineUpToCursor.trim() == '%' or lineUpToCursor.startsWith '\\'
|
if lineUpToCursor.trim() == '%' or lineUpToCursor.slice(0, 1) == '\\'
|
||||||
range = new Range(end.row, 0, end.row, end.column + 80)
|
range = new Range(end.row, 0, end.row, end.column + 80)
|
||||||
lineUpToCursor = @editor.getSession().getTextRange range
|
lineUpToCursor = @editor.getSession().getTextRange range
|
||||||
commandFragment = getLastCommandFragment lineUpToCursor
|
commandFragment = getLastCommandFragment lineUpToCursor
|
||||||
|
@ -44,9 +44,9 @@ define [
|
||||||
linesContainLabel or
|
linesContainLabel or
|
||||||
linesContainReqPackage
|
linesContainReqPackage
|
||||||
|
|
||||||
lastCommandFragmentIsLabel = commandFragment?.startsWith '\\label{'
|
lastCommandFragmentIsLabel = commandFragment?.slice(0, 7) == '\\label{'
|
||||||
lastCommandFragmentIsPackage = commandFragment?.startsWith '\\usepackage'
|
lastCommandFragmentIsPackage = commandFragment?.slice(0, 11) == '\\usepackage'
|
||||||
lastCommandFragmentIsReqPack = commandFragment?.startsWith '\\RequirePackage'
|
lastCommandFragmentIsReqPack = commandFragment?.slice(0, 15) == '\\RequirePackage'
|
||||||
lastCommandFragmentIsMeta =
|
lastCommandFragmentIsMeta =
|
||||||
lastCommandFragmentIsPackage or
|
lastCommandFragmentIsPackage or
|
||||||
lastCommandFragmentIsLabel or
|
lastCommandFragmentIsLabel or
|
||||||
|
|
Loading…
Reference in a new issue