allow toggling fold widget when editor isn't focused
This commit is contained in:
parent
43854d7a35
commit
63ce45752c
2 changed files with 7 additions and 2 deletions
|
|
@ -464,6 +464,11 @@ function Folding() {
|
||||||
return foldLine ? foldLine.end.row : docRow;
|
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) {
|
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
|
||||||
if (startRow == null) {
|
if (startRow == null) {
|
||||||
startRow = foldLine.start.row;
|
startRow = foldLine.start.row;
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,6 @@ function FoldHandler(editor) {
|
||||||
});
|
});
|
||||||
|
|
||||||
editor.on("guttermousedown", function(e) {
|
editor.on("guttermousedown", function(e) {
|
||||||
if (!editor.isFocused())
|
|
||||||
return;
|
|
||||||
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
|
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
|
||||||
|
|
||||||
if (gutterRegion == "foldWidgets") {
|
if (gutterRegion == "foldWidgets") {
|
||||||
|
|
@ -59,6 +57,8 @@ function FoldHandler(editor) {
|
||||||
var session = editor.session;
|
var session = editor.session;
|
||||||
if (session.foldWidgets && session.foldWidgets[row])
|
if (session.foldWidgets && session.foldWidgets[row])
|
||||||
editor.session.onFoldWidgetClick(row, e);
|
editor.session.onFoldWidgetClick(row, e);
|
||||||
|
if (!editor.isFocused())
|
||||||
|
editor.focus();
|
||||||
e.stop();
|
e.stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue