Fix inserting new line before and after fold

If you have your window like (notice the fold):

    class Main {
        public static void main(String[] args) {...}
    }<caret>

and then press `O`, you're expecting to get:

    class Main {
        public static void main(String[] args) {...}
        <caret>
    }

but actual result is:

    class Main {
        public static void main(String[] args) {
            <caret>
            // whatever in main
        }
    }

This pull request fixes the problem as well as adds test for it.