vim-patch:8.2.5013: after text formatting cursor may be in an invalid position

Problem:    After text formatting the cursor may be in an invalid position.
Solution:   Correct the cursor position after formatting.
78d52883e1
This commit is contained in:
zeertzjq
2022-08-02 05:55:07 +08:00
parent 4f576be881
commit 50672e3850
2 changed files with 15 additions and 0 deletions

View File

@@ -4349,6 +4349,9 @@ static void op_format(oparg_T *oap, int keep_cursor)
if (keep_cursor) {
curwin->w_cursor = saved_cursor;
saved_cursor.lnum = 0;
// formatting may have made the cursor position invalid
check_cursor();
}
if (oap->is_VIsual) {