diff --git a/lib/ace/edit_session/folding.js b/lib/ace/edit_session/folding.js index 1a3ffa5f..68746b71 100644 --- a/lib/ace/edit_session/folding.js +++ b/lib/ace/edit_session/folding.js @@ -358,8 +358,8 @@ function Folding() { var startRow = foldLine.start.row; var endRow = foldLine.end.row; - var foldLines = this.$foldData, - folds = foldLine.folds; + var foldLines = this.$foldData; + var folds = foldLine.folds; // Simple case where there is only one fold in the FoldLine such that // the entire fold line can get removed directly. if (folds.length == 1) { diff --git a/lib/ace/mouse/default_handlers.js b/lib/ace/mouse/default_handlers.js index 9a4450a0..2ae23cbf 100644 --- a/lib/ace/mouse/default_handlers.js +++ b/lib/ace/mouse/default_handlers.js @@ -94,20 +94,12 @@ function DefaultHandlers(editor) { if (selectionEmpty) { editor.moveCursorToPosition(pos); } - if(button == 2) { + if (button == 2) { editor.textInput.onContextMenu({x: ev.clientX, y: ev.clientY}, selectionEmpty); event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose); } return; } - else { - // Select the fold as the user clicks it. - var fold = editor.session.getFoldAt(pos.row, pos.column, 1); - if (fold) { - editor.selection.setSelectionRange(fold.range); - return; - } - } if (!inSelection) { // Directly pick STATE_SELECT, since the user is not clicking inside diff --git a/lib/ace/mouse/fold_handler.js b/lib/ace/mouse/fold_handler.js index 6afb017e..31a41753 100644 --- a/lib/ace/mouse/fold_handler.js +++ b/lib/ace/mouse/fold_handler.js @@ -40,18 +40,20 @@ define(function(require, exports, module) { function FoldHandler(editor) { - editor.on("click", function(ev) { - var pos = ev.getDocumentPosition(); + + editor.on("click", function(event) { + var position = event.getDocumentPosition(); + var session = editor.session; // If the user dclicked on a fold, then expand it. - var fold = editor.session.getFoldAt(pos.row, pos.column, 1); + var fold = session.getFoldAt(position.row, position.column, 1); if (fold) { - if (ev.getAccelKey()) - editor.session.removeFold(fold); + if (event.getAccelKey()) + session.removeFold(fold); else - editor.session.expandFold(fold); + session.expandFold(fold); - ev.preventDefault(); + event.preventDefault(); } }); }