Refined code

refined code and implemented select all(ctrl+a) for text_editor