zedapp/zed — pull request #128 by robru (2014-03-14 22:02:58+00:00)
Title: Implement a broken session.getBeforeAndAfter.

Ok, need a bit of help with this one. What I want to do is have a sandbox API called `session.getBeforeAndAfter`, which passes the following arguments to the callback: all text before the cursor, cursor index, and all text after the cursor. This would form the foundation for many extensions wanting to manipulate the areas adjacent to the cursor, such as the "Just One Space" extension I want to build on top of this.

So, my first instict was to just call `session.getCursorIndex` that you just merged, but I get this error in the log:

```
* [exception] Uncaught TypeError: Object [object global] has no method 'getCursorIndex' undefined
```
What am I missing here? Why can't one function from the session API call another? Why is 'this' invalid in this context? How can we fix this so these functions can call one another?