mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-08 08:05:06 +00:00
Simplify logic for deciding whether to re-scan doc on not
This commit is contained in:
parent
faf0337ca9
commit
039d18bf8b
1 changed files with 4 additions and 12 deletions
|
@ -23,20 +23,12 @@ define [
|
||||||
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)
|
||||||
commandFragment = getLastCommandFragment(lineUpToCursor)
|
commandFragment = getLastCommandFragment(lineUpToCursor)
|
||||||
if change.action == 'remove'
|
|
||||||
if _.any(change.lines, (line) -> line.match(/\\label\{[^\}\n\\]{0,80}\}/))
|
|
||||||
@scheduleLoadLabelsFromOpenDoc()
|
|
||||||
if commandFragment? and commandFragment.length > 2
|
|
||||||
if commandFragment.startsWith('\\label{')
|
|
||||||
@scheduleLoadLabelsFromOpenDoc()
|
|
||||||
if (
|
if (
|
||||||
change.action == "insert" and
|
change.action in ['remove', 'insert'] and
|
||||||
end.row == cursorPosition.row and
|
((_.any(change.lines, (line) -> line.match(/\\label\{[^\}\n\\]{0,80}\}/))) or
|
||||||
end.column == cursorPosition.column + 1
|
(commandFragment?.length > 2 and commandFragment.startsWith('\\label{')))
|
||||||
)
|
)
|
||||||
if commandFragment? and commandFragment.length > 2
|
@scheduleLoadLabelsFromOpenDoc()
|
||||||
if commandFragment.startsWith('\\label{')
|
|
||||||
@scheduleLoadLabelsFromOpenDoc()
|
|
||||||
|
|
||||||
@editor.on "changeSession", (e) =>
|
@editor.on "changeSession", (e) =>
|
||||||
e.oldSession.off "change", onChange
|
e.oldSession.off "change", onChange
|
||||||
|
|
Loading…
Reference in a new issue