It may be safer to use directly [indexToPosition](http://ace.c9.io/#Document.indexToPosition) function from ACE API