Merge pull request #2 from abhibeckert/master

Pull
fix search range to prevent out of bounds

Inserting a new line at end of document will throw an out-of-bounds
exception
Merge pull request #128 from eldenchen/master

fix search range to prevent out of bounds