don't sélect on unfold

This commit is contained in:
Fabian Jakobs 2011-12-14 13:28:02 +01:00
commit 653a88ff30
3 changed files with 12 additions and 18 deletions

View file

@ -358,8 +358,8 @@ function Folding() {
var startRow = foldLine.start.row; var startRow = foldLine.start.row;
var endRow = foldLine.end.row; var endRow = foldLine.end.row;
var foldLines = this.$foldData, var foldLines = this.$foldData;
folds = foldLine.folds; var folds = foldLine.folds;
// Simple case where there is only one fold in the FoldLine such that // Simple case where there is only one fold in the FoldLine such that
// the entire fold line can get removed directly. // the entire fold line can get removed directly.
if (folds.length == 1) { if (folds.length == 1) {

View file

@ -100,14 +100,6 @@ function DefaultHandlers(editor) {
} }
return; 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) { if (!inSelection) {
// Directly pick STATE_SELECT, since the user is not clicking inside // Directly pick STATE_SELECT, since the user is not clicking inside

View file

@ -40,18 +40,20 @@
define(function(require, exports, module) { define(function(require, exports, module) {
function FoldHandler(editor) { 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. // 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 (fold) {
if (ev.getAccelKey()) if (event.getAccelKey())
editor.session.removeFold(fold); session.removeFold(fold);
else else
editor.session.expandFold(fold); session.expandFold(fold);
ev.preventDefault(); event.preventDefault();
} }
}); });
} }