Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #5 from ajaxorg/fix/find-node
Browse files Browse the repository at this point in the history
Fix findNode
  • Loading branch information
Zef Hemel committed May 15, 2012
2 parents 6417527 + 46dea1d commit c7ee419
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/treehugger/tree.js
@@ -1,15 +1,15 @@
define(function(require, exports, module) {

function inRange(p, pos) {
if(p && p.sl <= pos.line && p.el >= pos.line) {
if(p.sl < pos.line && p.el > pos.line)
if(p && p.sl <= pos.line && pos.line <= p.el) {
if(p.sl < pos.line && pos.line < p.el)
return true;
else if(p.sl == pos.line && p.el > pos.line)
else if(p.sl == pos.line && pos.line < p.el)
return p.sc <= pos.col;
else if(p.sl == pos.line && p.el === pos.line)
return p.sc <= pos.col && p.ec >= pos.col;
return p.sc <= pos.col && pos.col <= p.ec;
else if(p.sl < pos.line && p.el === pos.line)
return p.ec >= pos.col;
return pos.col <= p.ec;
}
}

Expand Down Expand Up @@ -202,7 +202,7 @@ ConsNode.prototype.findNode = function(pos) {
var node = this[i].findNode(pos);
if(node)
return node instanceof StringNode ? this : node;
else
else if(p2.sl == p2.el)
return this[i];
}
}
Expand Down

0 comments on commit c7ee419

Please sign in to comment.