[tern addon] Fix corner case bug when editing near end of document
[tern addon] Fix corner case bug when editing near end of document

Closes #4954

wingify/CodeMirror,codio/CodeMirror,mtaran-google/CodeMirror,SidPresse/CodeMirror,mtaran-google/CodeMirror,thomasjm/CodeMirror,hackmdio/CodeMirror,MarcelGerber/CodeMirror,jkaplon/CodeMirror,thomasjm/CodeMirror,mtaran-google/CodeMirror,ficristo/CodeMirror,thomasjm/CodeMirror,jayaprabhakar/CodeMirror,jayaprabhakar/CodeMirror,codio/CodeMirror,notepadqq/CodeMirror,namin/CodeMirror,SidPresse/CodeMirror,notepadqq/CodeMirror,jkaplon/CodeMirror,wingify/CodeMirror,SidPresse/CodeMirror,MarcelGerber/CodeMirror,nightwing/CodeMirror,pabloferz/CodeMirror,ficristo/CodeMirror,hackmdio/CodeMirror,codio/CodeMirror,pabloferz/CodeMirror,notepadqq/CodeMirror,dperetti/CodeMirror,dperetti/CodeMirror,MarcelGerber/CodeMirror,hackmdio/CodeMirror,ficristo/CodeMirror,jkaplon/CodeMirror,jayaprabhakar/CodeMirror,dperetti/CodeMirror,wingify/CodeMirror,pabloferz/CodeMirror,namin/CodeMirror,nightwing/CodeMirror,namin/CodeMirror,nightwing/CodeMirror