Implement delete function.

Minor bug exist, cursor position v.s. event firing is unstable for some exceptional conditions.