mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-09 13:15:37 +03:00
c99ac52152
In attempting to optimize the performance of `isFoldableAtBufferRow` in
3c87b74
, we mistakenly introduced a bug that caused lines that contained
a comment but didn't start with one to not be foldable anymore.
With this commit we are restoring the previous behavior, thus only
disabling folding for lines that start with a comment (ignoring leading
whitespaces).
32 lines
841 B
JavaScript
32 lines
841 B
JavaScript
var quicksort = function () {
|
|
/*
|
|
this is a multiline comment
|
|
it is, I promise
|
|
*/
|
|
var sort = function(items) { // comment at the end of a foldable line
|
|
// This is a collection of
|
|
// single line comments.
|
|
// Wowza
|
|
if (items.length <= 1) return items;
|
|
var pivot = items.shift(), current, left = [], right = [];
|
|
/*
|
|
This is a multiline comment block with
|
|
an empty line inside of it.
|
|
|
|
Awesome.
|
|
*/
|
|
while(items.length > 0) {
|
|
current = items.shift();
|
|
current < pivot ? left.push(current) : right.push(current);
|
|
}
|
|
// This is a collection of
|
|
// single line comments
|
|
|
|
// ...with an empty line
|
|
// among it, geez!
|
|
return sort(left).concat(pivot).concat(sort(right));
|
|
};
|
|
// this is a single-line comment
|
|
return sort(Array.apply(this, arguments));
|
|
};
|