Add some features

* Add class BaseMode
* Fix a bug in function find_pos
* Add resize
Fix bugs in resize, newline, scroll ant etc.