undo/redo actions for text viewer/editor
fixed some issues in viewer/editor