newSkipList() -> new SkipList()

pull/563/head
Matthias Bartelmeß 2012-03-18 11:34:56 +01:00
parent 902837f295
commit 38742401c9
2 changed files with 9 additions and 31 deletions

View File

@ -46,7 +46,7 @@ var domline = require('./domline').domline;
var AttribPool = require('./AttributePool'); var AttribPool = require('./AttributePool');
var Changeset = require('./Changeset'); var Changeset = require('./Changeset');
var linestylefilter = require('./linestylefilter').linestylefilter; var linestylefilter = require('./linestylefilter').linestylefilter;
var newSkipList = require('./skiplist').newSkipList; var SkipList = require('./skiplist');
var undoModule = require('./undomodule').undoModule; var undoModule = require('./undomodule').undoModule;
var makeVirtualLineView = require('./virtual_lines').makeVirtualLineView; var makeVirtualLineView = require('./virtual_lines').makeVirtualLineView;
@ -95,7 +95,7 @@ function Ace2Inner(){
// native IE selections have that behavior (which we try not to interfere with). // native IE selections have that behavior (which we try not to interfere with).
// Must be false if selection is collapsed! // Must be false if selection is collapsed!
var rep = { var rep = {
lines: newSkipList(), lines: new SkipList(),
selStart: null, selStart: null,
selEnd: null, selEnd: null,
selFocusAtStart: false, selFocusAtStart: false,

View File

@ -20,11 +20,11 @@
* limitations under the License. * limitations under the License.
*/ */
var Ace2Common = require('./ace2_common');
var noop = Ace2Common.noop;
var extend = Ace2Common.extend;
var noop = require('./ace2_common').noop; function SkipList()
function newSkipList()
{ {
var PROFILER = window.PROFILER; var PROFILER = window.PROFILER;
if (!PROFILER) if (!PROFILER)
@ -284,27 +284,6 @@ function newSkipList()
} }
return dist; return dist;
} }
/*function _debugToString() {
var array = [start];
while (array[array.length-1] !== end) {
array[array.length] = array[array.length-1].downPtrs[0];
}
function getIndex(node) {
if (!node) return null;
for(var i=0;i<array.length;i++) {
if (array[i] === node)
return i-1;
}
return false;
}
var processedArray = map(array, function(node) {
var x = {key:node.key, levels: node.levels, downSkips: node.downSkips,
upPtrs: map(node.upPtrs, getIndex), downPtrs: map(node.downPtrs, getIndex),
downSkipWidths: node.downSkipWidths};
return x;
});
return map(processedArray, function (x) { return x.toSource(); }).join("\n");
}*/
function _getNodeByKey(key) function _getNodeByKey(key)
{ {
@ -346,7 +325,7 @@ function newSkipList()
The skip-list contains "entries", JavaScript objects that each must have a unique "key" property The skip-list contains "entries", JavaScript objects that each must have a unique "key" property
that is a string. that is a string.
*/ */
var self = { extend(this, {
length: function() length: function()
{ {
return numNodes; return numNodes;
@ -482,8 +461,7 @@ that is a string.
{ {
return start.levels; return start.levels;
} }
} });
return self;
} }
exports.newSkipList = newSkipList; module.exports = SkipList;