[text editor] fix bug and tests