Make sure doc.scrollTop is accurate post-display-update

Closes #1351
Improve closebrackets.js addon

- Do not insert closing bracket if a spacechar or closing bracket
  follows cursor
- Do not handle backspace if selection is not empty
- Do not overwrite anything if selection is not empty
- If selection is not empty and open bracket is inserted - surround
  selection with brackets.