Rewrote some methods

1.Rewrote some methods
2.Fixed the crash bug when cutting the text