Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Fold comentaries for demo case only
Browse files Browse the repository at this point in the history
Since the license header is too big let's fold it to be
more readable when running the demo case.

Signed-off-by: Bruno Bottazzini <bruno.bottazzini@intel.com>
  • Loading branch information
Bruno Bottazzini committed Nov 10, 2015
1 parent a51092b commit 5389b18
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions client/js/controllers/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
$scope.fbpType = true;
$scope.isServiceRunning = false;
var editor = ace.edit("fbp_editor");
var Range = require('ace/range').Range;
var aceConfig = require("ace/config");
var modelist = ace.require("ace/ext/modelist");
editor.setOptions({
Expand Down Expand Up @@ -112,6 +113,7 @@
$scope.fbpType = true;
aceConfig.set("modePath", "js/ace/");
editor.getSession().setMode("ace/mode/fbp");
foldHeaderCommentaries();
} else {
$scope.fbpType = false;
}
Expand Down Expand Up @@ -143,6 +145,31 @@
}
};

//Function that will folder header of a ace contents
function foldHeaderCommentaries() {
var lines = editor.session.getLines(0, editor.session.getLength());
var count = 0;
var l;
var ahead;
for (var i = 0; i < editor.session.getLength(); i++) {
l = editor.session.getLine(i);
if (l.charAt(0) !== "#") {
ahead = editor.session.getLine(i + 1);
if (ahead.charAt(0) !== "#") {
break;
} else {
count++;
}
} else {
count++;
}
}
var len = editor.session.getLine(count);
editor.session.selection.addRange(new Range(0, 0, count, 256));
editor.session.toggleFold(false);
editor.session.selection.clearSelection();
}

function jsTreeTraverse(state, nodes) {
var inst = $('#jstree').jstree(true);
var node = inst.get_node(state);
Expand Down

0 comments on commit 5389b18

Please sign in to comment.