don't sélect on unfold
This commit is contained in:
parent
312dfe7ddf
commit
653a88ff30
3 changed files with 12 additions and 18 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue