Karsten Hopp e26d45
To: vim_dev@googlegroups.com
Karsten Hopp e26d45
Subject: Patch 7.3.787
Karsten Hopp e26d45
Fcc: outbox
Karsten Hopp e26d45
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp e26d45
Mime-Version: 1.0
Karsten Hopp e26d45
Content-Type: text/plain; charset=UTF-8
Karsten Hopp e26d45
Content-Transfer-Encoding: 8bit
Karsten Hopp e26d45
------------
Karsten Hopp e26d45
Karsten Hopp e26d45
Patch 7.3.787
Karsten Hopp e26d45
Problem:    With 'relativenumber' set it is not possible to see the absolute
Karsten Hopp e26d45
	    line number.
Karsten Hopp e26d45
Solution:   For the cursor line show the absolute line number instead of a
Karsten Hopp e26d45
	    zero. (Nazri Ramliy)
Karsten Hopp e26d45
Files:	    src/screen.c
Karsten Hopp e26d45
Karsten Hopp e26d45
Karsten Hopp e26d45
*** ../vim-7.3.786/src/screen.c	2012-12-05 16:10:21.000000000 +0100
Karsten Hopp e26d45
--- src/screen.c	2013-01-30 12:29:33.000000000 +0100
Karsten Hopp e26d45
***************
Karsten Hopp e26d45
*** 2319,2324 ****
Karsten Hopp e26d45
--- 2319,2325 ----
Karsten Hopp e26d45
  	{
Karsten Hopp e26d45
  	    int	    w = number_width(wp);
Karsten Hopp e26d45
  	    long num;
Karsten Hopp e26d45
+ 	    char *fmt = "%*ld ";
Karsten Hopp e26d45
  
Karsten Hopp e26d45
  	    if (len > w + 1)
Karsten Hopp e26d45
  		len = w + 1;
Karsten Hopp e26d45
***************
Karsten Hopp e26d45
*** 2327,2336 ****
Karsten Hopp e26d45
  		/* 'number' */
Karsten Hopp e26d45
  		num = (long)lnum;
Karsten Hopp e26d45
  	    else
Karsten Hopp e26d45
  		/* 'relativenumber', don't use negative numbers */
Karsten Hopp e26d45
  		num = labs((long)get_cursor_rel_lnum(wp, lnum));
Karsten Hopp e26d45
  
Karsten Hopp e26d45
! 	    sprintf((char *)buf, "%*ld ", w, num);
Karsten Hopp e26d45
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp e26d45
  	    if (wp->w_p_rl)
Karsten Hopp e26d45
  		/* the line number isn't reversed */
Karsten Hopp e26d45
--- 2328,2344 ----
Karsten Hopp e26d45
  		/* 'number' */
Karsten Hopp e26d45
  		num = (long)lnum;
Karsten Hopp e26d45
  	    else
Karsten Hopp e26d45
+ 	    {
Karsten Hopp e26d45
  		/* 'relativenumber', don't use negative numbers */
Karsten Hopp e26d45
  		num = labs((long)get_cursor_rel_lnum(wp, lnum));
Karsten Hopp e26d45
+ 		if (num == 0)
Karsten Hopp e26d45
+ 		{
Karsten Hopp e26d45
+ 		    num = lnum;
Karsten Hopp e26d45
+ 		    fmt = "%-*ld ";
Karsten Hopp e26d45
+ 		}
Karsten Hopp e26d45
+ 	    }
Karsten Hopp e26d45
  
Karsten Hopp e26d45
! 	    sprintf((char *)buf, fmt, w, num);
Karsten Hopp e26d45
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp e26d45
  	    if (wp->w_p_rl)
Karsten Hopp e26d45
  		/* the line number isn't reversed */
Karsten Hopp e26d45
***************
Karsten Hopp e26d45
*** 3484,3498 ****
Karsten Hopp e26d45
  			    )
Karsten Hopp e26d45
  		    {
Karsten Hopp e26d45
  			long num;
Karsten Hopp e26d45
  
Karsten Hopp e26d45
  			if (wp->w_p_nu)
Karsten Hopp e26d45
  			    /* 'number' */
Karsten Hopp e26d45
  			    num = (long)lnum;
Karsten Hopp e26d45
  			else
Karsten Hopp e26d45
  			    /* 'relativenumber', don't use negative numbers */
Karsten Hopp e26d45
  			    num = labs((long)get_cursor_rel_lnum(wp, lnum));
Karsten Hopp e26d45
  
Karsten Hopp e26d45
! 			sprintf((char *)extra, "%*ld ",
Karsten Hopp e26d45
  						number_width(wp), num);
Karsten Hopp e26d45
  			if (wp->w_skipcol > 0)
Karsten Hopp e26d45
  			    for (p_extra = extra; *p_extra == ' '; ++p_extra)
Karsten Hopp e26d45
--- 3492,3514 ----
Karsten Hopp e26d45
  			    )
Karsten Hopp e26d45
  		    {
Karsten Hopp e26d45
  			long num;
Karsten Hopp e26d45
+ 			char *fmt = "%*ld ";
Karsten Hopp e26d45
  
Karsten Hopp e26d45
  			if (wp->w_p_nu)
Karsten Hopp e26d45
  			    /* 'number' */
Karsten Hopp e26d45
  			    num = (long)lnum;
Karsten Hopp e26d45
  			else
Karsten Hopp e26d45
+ 			{
Karsten Hopp e26d45
  			    /* 'relativenumber', don't use negative numbers */
Karsten Hopp e26d45
  			    num = labs((long)get_cursor_rel_lnum(wp, lnum));
Karsten Hopp e26d45
+ 			    if (num == 0)
Karsten Hopp e26d45
+ 			    {
Karsten Hopp e26d45
+ 				num = lnum;
Karsten Hopp e26d45
+ 				fmt = "%-*ld ";
Karsten Hopp e26d45
+ 			    }
Karsten Hopp e26d45
+ 			}
Karsten Hopp e26d45
  
Karsten Hopp e26d45
! 			sprintf((char *)extra, fmt,
Karsten Hopp e26d45
  						number_width(wp), num);
Karsten Hopp e26d45
  			if (wp->w_skipcol > 0)
Karsten Hopp e26d45
  			    for (p_extra = extra; *p_extra == ' '; ++p_extra)
Karsten Hopp e26d45
***************
Karsten Hopp e26d45
*** 3513,3519 ****
Karsten Hopp e26d45
  		     * the current line differently.
Karsten Hopp e26d45
  		     * TODO: Can we use CursorLine instead of CursorLineNr
Karsten Hopp e26d45
  		     * when CursorLineNr isn't set? */
Karsten Hopp e26d45
! 		    if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
Karsten Hopp e26d45
  			char_attr = hl_attr(HLF_CLN);
Karsten Hopp e26d45
  #endif
Karsten Hopp e26d45
  		}
Karsten Hopp e26d45
--- 3529,3536 ----
Karsten Hopp e26d45
  		     * the current line differently.
Karsten Hopp e26d45
  		     * TODO: Can we use CursorLine instead of CursorLineNr
Karsten Hopp e26d45
  		     * when CursorLineNr isn't set? */
Karsten Hopp e26d45
! 		    if ((wp->w_p_cul || wp->w_p_rnu)
Karsten Hopp e26d45
! 						 && lnum == wp->w_cursor.lnum)
Karsten Hopp e26d45
  			char_attr = hl_attr(HLF_CLN);
Karsten Hopp e26d45
  #endif
Karsten Hopp e26d45
  		}
Karsten Hopp e26d45
***************
Karsten Hopp e26d45
*** 10238,10249 ****
Karsten Hopp e26d45
      int		n;
Karsten Hopp e26d45
      linenr_T	lnum;
Karsten Hopp e26d45
  
Karsten Hopp e26d45
!     if (wp->w_p_nu)
Karsten Hopp e26d45
! 	/* 'number' */
Karsten Hopp e26d45
! 	lnum = wp->w_buffer->b_ml.ml_line_count;
Karsten Hopp e26d45
!     else
Karsten Hopp e26d45
! 	/* 'relativenumber' */
Karsten Hopp e26d45
! 	lnum = wp->w_height;
Karsten Hopp e26d45
  
Karsten Hopp e26d45
      if (lnum == wp->w_nrwidth_line_count)
Karsten Hopp e26d45
  	return wp->w_nrwidth_width;
Karsten Hopp e26d45
--- 10255,10261 ----
Karsten Hopp e26d45
      int		n;
Karsten Hopp e26d45
      linenr_T	lnum;
Karsten Hopp e26d45
  
Karsten Hopp e26d45
!     lnum = wp->w_buffer->b_ml.ml_line_count;
Karsten Hopp e26d45
  
Karsten Hopp e26d45
      if (lnum == wp->w_nrwidth_line_count)
Karsten Hopp e26d45
  	return wp->w_nrwidth_width;
Karsten Hopp e26d45
*** ../vim-7.3.786/src/version.c	2013-01-30 11:44:33.000000000 +0100
Karsten Hopp e26d45
--- src/version.c	2013-01-30 12:25:10.000000000 +0100
Karsten Hopp e26d45
***************
Karsten Hopp e26d45
*** 727,728 ****
Karsten Hopp e26d45
--- 727,730 ----
Karsten Hopp e26d45
  {   /* Add new patch number below this line */
Karsten Hopp e26d45
+ /**/
Karsten Hopp e26d45
+     787,
Karsten Hopp e26d45
  /**/
Karsten Hopp e26d45
Karsten Hopp e26d45
-- 
Karsten Hopp e26d45
ARTHUR:        A scratch?  Your arm's off!
Karsten Hopp e26d45
BLACK KNIGHT:  No, it isn't.
Karsten Hopp e26d45
ARTHUR:        Well, what's that then?
Karsten Hopp e26d45
BLACK KNIGHT:  I've had worse.
Karsten Hopp e26d45
                                  The Quest for the Holy Grail (Monty Python)
Karsten Hopp e26d45
Karsten Hopp e26d45
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp e26d45
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp e26d45
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp e26d45
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///