add "distinct" functionality for cursors, tests

First pull request, working with texuf. cheers.