More tests (for annotations) and some cleanup. Also added a method to retrieve selection range from the editor.