From debb0c06a4310166fdb17388661d34218b27dfc1 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 12 Jun 2017 14:23:29 +0100 Subject: [PATCH] Clearer logic for triggering labels-loading --- .../directives/aceEditor/labels/LabelsManager.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/labels/LabelsManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/labels/LabelsManager.coffee index 239a05dff9..07b60b08b9 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/labels/LabelsManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/labels/LabelsManager.coffee @@ -16,16 +16,16 @@ define [ onChange = (change) => if change.remote return + if change.action not in ['remove', 'insert'] + return cursorPosition = @editor.getCursorPosition() end = change.end range = new Range(end.row, 0, end.row, end.column) lineUpToCursor = @editor.getSession().getTextRange(range) commandFragment = getLastCommandFragment(lineUpToCursor) - if ( - change.action in ['remove', 'insert'] and - ((_.any(change.lines, (line) -> line.match(/\\label\{[^\}\n\\]{0,80}\}/))) or - (commandFragment?.length > 2 and commandFragment.slice(0,7) == '\\label{')) - ) + linesContainLabel = _.any(change.lines, (line) -> line.match(/\\label\{[^\}\n\\]{0,80}\}/)) + lastCommandFragmentIsLabel = commandFragment?.slice(0,7) == '\\label{' + if linesContainLabel or lastCommandFragmentIsLabel @scheduleLoadCurrentDocLabelsFromServer() @editor.on "changeSession", (e) =>