ace nits and warning cleanup

- switch to `session.doc.setValue()` when replacing changed file contents - this preserves the undo stack (as per https://github.com/dart-lang/chromedeveditor/issues/1698)
- fix a checked mode issue in ace.dart
- address an analysis warning

@ussuri, @umop 
Not sure I understand - we need to record the cursor position before we change the text.