add autopair, improved doc-view mode