Fixed broken cursor position in text operations
Added assertions
refs #596