Adapt to changes in master.

See scala-ide/scala-ide#812
I don't know if it breaks anything, but it is not equivalent to the previous implementation. It used to also adjust the length, by computing the new position of the last character of the original region, and then the difference with the new offset.
It was also adding + 1 to the length if not null (not sure why).