allow toggling fold widget when editor isn't focused

This commit is contained in:
nightwing 2013-02-24 13:50:46 +04:00
commit 63ce45752c
2 changed files with 7 additions and 2 deletions

View file

@ -464,6 +464,11 @@ function Folding() {
return foldLine ? foldLine.end.row : docRow;
};
this.getRowFoldStart = function(docRow, startFoldRow) {
var foldLine = this.getFoldLine(docRow, startFoldRow);
return foldLine ? foldLine.start.row : docRow;
};
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
if (startRow == null) {
startRow = foldLine.start.row;

View file

@ -50,8 +50,6 @@ function FoldHandler(editor) {
});
editor.on("guttermousedown", function(e) {
if (!editor.isFocused())
return;
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
if (gutterRegion == "foldWidgets") {
@ -59,6 +57,8 @@ function FoldHandler(editor) {
var session = editor.session;
if (session.foldWidgets && session.foldWidgets[row])
editor.session.onFoldWidgetClick(row, e);
if (!editor.isFocused())
editor.focus();
e.stop();
}
});