From 5ae77a4366290826de65a0bad18e375aea8fc525 Mon Sep 17 00:00:00 2001 From: Patrick Oladimeji Date: Mon, 17 Apr 2017 00:11:17 +0100 Subject: [PATCH] Addresses #13282 which caused performance issues when navigating between large folded files. A check is now performed to ensure we do not attempt to restore line folds for editors whose folds have already been initialised. --- src/extensions/default/CodeFolding/main.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/extensions/default/CodeFolding/main.js b/src/extensions/default/CodeFolding/main.js index 0e6f4e35b1a..9c900086e2f 100644 --- a/src/extensions/default/CodeFolding/main.js +++ b/src/extensions/default/CodeFolding/main.js @@ -38,6 +38,7 @@ define(function (require, exports, module) { EditorManager = brackets.getModule("editor/EditorManager"), ProjectManager = brackets.getModule("project/ProjectManager"), ViewStateManager = brackets.getModule("view/ViewStateManager"), + MainViewManager = brackets.getModule("view/MainViewManager"), KeyBindingManager = brackets.getModule("command/KeyBindingManager"), ExtensionUtils = brackets.getModule("utils/ExtensionUtils"), Menus = brackets.getModule("command/Menus"), @@ -329,14 +330,14 @@ define(function (require, exports, module) { } /** - * When a brand new editor is seen, initialise fold-gutter and restore line folds in it. Save line folds in - * departing editor in case it's getting closed. + * When a brand new editor is seen, initialise fold-gutter and restore line folds in it. + * Save line folds in departing editor in case it's getting closed. * @param {object} event the event object * @param {Editor} current the current editor * @param {Editor} previous the previous editor */ function onActiveEditorChanged(event, current, previous) { - if (current) { + if (current && !current._codeMirror._lineFolds) { enableFoldingInEditor(current); } if (previous) {