updated for version 7.3.830
Problem: :mksession confuses bytes, columns and characters when positioning
the cursor.
Solution: Use w_virtcol with "|" instead of w_cursor.col with "l".
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 4c4c9e9..62ae3ad 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -10829,24 +10829,24 @@
{
if (fprintf(fd,
"let s:c = %ld - ((%ld * winwidth(0) + %ld) / %ld)",
- (long)wp->w_cursor.col,
- (long)(wp->w_cursor.col - wp->w_leftcol),
+ (long)wp->w_virtcol + 1,
+ (long)(wp->w_virtcol - wp->w_leftcol),
(long)wp->w_width / 2, (long)wp->w_width) < 0
|| put_eol(fd) == FAIL
|| put_line(fd, "if s:c > 0") == FAIL
|| fprintf(fd,
- " exe 'normal! 0' . s:c . 'lzs' . (%ld - s:c) . 'l'",
- (long)wp->w_cursor.col) < 0
+ " exe 'normal! ' . s:c . '|zs' . %ld . '|'",
+ (long)wp->w_virtcol + 1) < 0
|| put_eol(fd) == FAIL
|| put_line(fd, "else") == FAIL
- || fprintf(fd, " normal! 0%dl", wp->w_cursor.col) < 0
+ || fprintf(fd, " normal! %d|", wp->w_virtcol + 1) < 0
|| put_eol(fd) == FAIL
|| put_line(fd, "endif") == FAIL)
return FAIL;
}
else
{
- if (fprintf(fd, "normal! 0%dl", wp->w_cursor.col) < 0
+ if (fprintf(fd, "normal! 0%d|", wp->w_virtcol + 1) < 0
|| put_eol(fd) == FAIL)
return FAIL;
}