TextArea: fixing some dialog issues

1. must update the scrollbar when dialog ends
2. fix extra newlines
3. only scroll to bottom when the TA is autoscroll
4. use a reverse iterator for getting the last content

there are still issues with subsequent dialogs that I need to figure out