Fix near ancestor to prevent go out of editor bounds.
Merge pull request #151 from topicus/fix-near-ancestor

Fix near ancestor to prevent go out of editor bounds.