astepano / rpms / vim

Forked from rpms/vim 6 years ago
Clone
Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.3.830
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 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".
Files:	    src/ex_docmd.c


*** ../vim-7.3.829/src/ex_docmd.c	2013-02-14 22:11:31.000000000 +0100
--- src/ex_docmd.c	2013-02-20 19:13:21.000000000 +0100
***************
*** 10829,10852 ****
  	    {
  		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_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
  			|| put_eol(fd) == FAIL
  			|| put_line(fd, "else") == FAIL
! 			|| fprintf(fd, "  normal! 0%dl", wp->w_cursor.col) < 0
  			|| put_eol(fd) == FAIL
  			|| put_line(fd, "endif") == FAIL)
  		    return FAIL;
  	    }
  	    else
  	    {
! 		if (fprintf(fd, "normal! 0%dl", wp->w_cursor.col) < 0
  			|| put_eol(fd) == FAIL)
  		    return FAIL;
  	    }
--- 10829,10852 ----
  	    {
  		if (fprintf(fd,
  			  "let s:c = %ld - ((%ld * winwidth(0) + %ld) / %ld)",
! 			    (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! ' . s:c . '|zs' . %ld . '|'",
! 			    (long)wp->w_virtcol + 1) < 0
  			|| put_eol(fd) == FAIL
  			|| put_line(fd, "else") == FAIL
! 			|| 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%d|", wp->w_virtcol + 1) < 0
  			|| put_eol(fd) == FAIL)
  		    return FAIL;
  	    }
*** ../vim-7.3.829/src/version.c	2013-02-20 18:39:07.000000000 +0100
--- src/version.c	2013-02-20 19:14:18.000000000 +0100
***************
*** 730,731 ****
--- 730,733 ----
  {   /* Add new patch number below this line */
+ /**/
+     830,
  /**/

-- 
Westheimer's Discovery:
        A couple of months in the laboratory can
        frequently save a couple of hours in the library.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///