Fix #42: Fix broken iterating over RSyntaxDocument and add unit test for it