Import Lelldorin's fixes.

From
http://haikuware.com/remository/view-details/development/editors/unofficial-yab-17-fixed-paste-error-of-textedit