Make vertical motion collapse selection when one exists

Closes #2042
[r mode] Fix bad post-'else if' indentation.
Use separate node for forcing cursor to be scrolled into view

Using the cursor itself was awkward already, but turns out to
also have strange effects (it was somehow treated as having height: 0
in some situations, by all browsers).
In indentLine, clear empty lines when aggressive is false
Use inner mode's electricChars property

Also moves handling of electricChars to readInput, removing
the timeout kludge.

Issue #2029
merge