1
0
forked from aniani/vim

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".
This commit is contained in:
Bram Moolenaar
2013-02-20 19:26:29 +01:00
parent 187d3acb7f
commit 558ddad8e8
2 changed files with 8 additions and 6 deletions

View File

@@ -10829,24 +10829,24 @@ put_view(fd, wp, add_edit, flagp, current_arg_idx)
{ {
if (fprintf(fd, if (fprintf(fd,
"let s:c = %ld - ((%ld * winwidth(0) + %ld) / %ld)", "let s:c = %ld - ((%ld * winwidth(0) + %ld) / %ld)",
(long)wp->w_cursor.col, (long)wp->w_virtcol + 1,
(long)(wp->w_cursor.col - wp->w_leftcol), (long)(wp->w_virtcol - wp->w_leftcol),
(long)wp->w_width / 2, (long)wp->w_width) < 0 (long)wp->w_width / 2, (long)wp->w_width) < 0
|| put_eol(fd) == FAIL || put_eol(fd) == FAIL
|| put_line(fd, "if s:c > 0") == FAIL || put_line(fd, "if s:c > 0") == FAIL
|| fprintf(fd, || fprintf(fd,
" exe 'normal! 0' . s:c . 'lzs' . (%ld - s:c) . 'l'", " exe 'normal! ' . s:c . '|zs' . %ld . '|'",
(long)wp->w_cursor.col) < 0 (long)wp->w_virtcol + 1) < 0
|| put_eol(fd) == FAIL || put_eol(fd) == FAIL
|| put_line(fd, "else") == 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_eol(fd) == FAIL
|| put_line(fd, "endif") == FAIL) || put_line(fd, "endif") == FAIL)
return FAIL; return FAIL;
} }
else 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) || put_eol(fd) == FAIL)
return FAIL; return FAIL;
} }

View File

@@ -728,6 +728,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
830,
/**/ /**/
829, 829,
/**/ /**/