Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #5 from ajaxorg/fix/find-node

Fix findNode
  • Loading branch information...
commit c7ee419c6c985d4369d71619b8e97044de3e502e 2 parents 6417527 + 46dea1d
Zef Hemel zefhemel authored

Showing 1 changed file with 6 additions and 6 deletions. Show diff stats Hide diff stats

  1. +6 6 lib/treehugger/tree.js
12 lib/treehugger/tree.js
... ... @@ -1,15 +1,15 @@
1 1 define(function(require, exports, module) {
2 2
3 3 function inRange(p, pos) {
4   - if(p && p.sl <= pos.line && p.el >= pos.line) {
5   - if(p.sl < pos.line && p.el > pos.line)
  4 + if(p && p.sl <= pos.line && pos.line <= p.el) {
  5 + if(p.sl < pos.line && pos.line < p.el)
6 6 return true;
7   - else if(p.sl == pos.line && p.el > pos.line)
  7 + else if(p.sl == pos.line && pos.line < p.el)
8 8 return p.sc <= pos.col;
9 9 else if(p.sl == pos.line && p.el === pos.line)
10   - return p.sc <= pos.col && p.ec >= pos.col;
  10 + return p.sc <= pos.col && pos.col <= p.ec;
11 11 else if(p.sl < pos.line && p.el === pos.line)
12   - return p.ec >= pos.col;
  12 + return pos.col <= p.ec;
13 13 }
14 14 }
15 15
@@ -202,7 +202,7 @@ ConsNode.prototype.findNode = function(pos) {
202 202 var node = this[i].findNode(pos);
203 203 if(node)
204 204 return node instanceof StringNode ? this : node;
205   - else
  205 + else if(p2.sl == p2.el)
206 206 return this[i];
207 207 }
208 208 }

0 comments on commit c7ee419

Please sign in to comment.
Something went wrong with that request. Please try again.