Formatter: cursor position is saved when invoking autoformat. Fixes #2293