Karsten Hopp 227f6b
To: vim_dev@googlegroups.com
Karsten Hopp 227f6b
Subject: Patch 7.3.426
Karsten Hopp 227f6b
Fcc: outbox
Karsten Hopp 227f6b
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 227f6b
Mime-Version: 1.0
Karsten Hopp 227f6b
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 227f6b
Content-Transfer-Encoding: 8bit
Karsten Hopp 227f6b
------------
Karsten Hopp 227f6b
Karsten Hopp 227f6b
Patch 7.3.426
Karsten Hopp 227f6b
Problem:    With '$' in 'cpoptions' the $ is not displayed in the first
Karsten Hopp 227f6b
            column.
Karsten Hopp 227f6b
Solution:   Use -1 instead of 0 as a special value. (Hideki Eiraku and
Karsten Hopp 227f6b
            Hirohito Higashi)
Karsten Hopp 227f6b
Files:      src/edit.c, src/globals.h, src/move.c, src/screen.c, src/search.c 
Karsten Hopp 227f6b
    
Karsten Hopp 227f6b
Karsten Hopp 227f6b
*** ../vim-7.3.425/src/edit.c	2012-01-26 18:58:25.000000000 +0100
Karsten Hopp 227f6b
--- src/edit.c	2012-02-04 23:23:45.000000000 +0100
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 1763,1771 ****
Karsten Hopp 227f6b
      static void
Karsten Hopp 227f6b
  undisplay_dollar()
Karsten Hopp 227f6b
  {
Karsten Hopp 227f6b
!     if (dollar_vcol)
Karsten Hopp 227f6b
      {
Karsten Hopp 227f6b
! 	dollar_vcol = 0;
Karsten Hopp 227f6b
  	redrawWinline(curwin->w_cursor.lnum, FALSE);
Karsten Hopp 227f6b
      }
Karsten Hopp 227f6b
  }
Karsten Hopp 227f6b
--- 1763,1771 ----
Karsten Hopp 227f6b
      static void
Karsten Hopp 227f6b
  undisplay_dollar()
Karsten Hopp 227f6b
  {
Karsten Hopp 227f6b
!     if (dollar_vcol >= 0)
Karsten Hopp 227f6b
      {
Karsten Hopp 227f6b
! 	dollar_vcol = -1;
Karsten Hopp 227f6b
  	redrawWinline(curwin->w_cursor.lnum, FALSE);
Karsten Hopp 227f6b
      }
Karsten Hopp 227f6b
  }
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 5441,5447 ****
Karsten Hopp 227f6b
  				compl_curr_match->cp_number);
Karsten Hopp 227f6b
  		edit_submode_extra = match_ref;
Karsten Hopp 227f6b
  		edit_submode_highl = HLF_R;
Karsten Hopp 227f6b
! 		if (dollar_vcol)
Karsten Hopp 227f6b
  		    curs_columns(FALSE);
Karsten Hopp 227f6b
  	    }
Karsten Hopp 227f6b
  	}
Karsten Hopp 227f6b
--- 5441,5447 ----
Karsten Hopp 227f6b
  				compl_curr_match->cp_number);
Karsten Hopp 227f6b
  		edit_submode_extra = match_ref;
Karsten Hopp 227f6b
  		edit_submode_highl = HLF_R;
Karsten Hopp 227f6b
! 		if (dollar_vcol >= 0)
Karsten Hopp 227f6b
  		    curs_columns(FALSE);
Karsten Hopp 227f6b
  	    }
Karsten Hopp 227f6b
  	}
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 8961,8967 ****
Karsten Hopp 227f6b
       * We can emulate the vi behaviour by pretending there is a dollar
Karsten Hopp 227f6b
       * displayed even when there isn't.
Karsten Hopp 227f6b
       *  --pkv Sun Jan 19 01:56:40 EST 2003 */
Karsten Hopp 227f6b
!     if (vim_strchr(p_cpo, CPO_BACKSPACE) != NULL && dollar_vcol == 0)
Karsten Hopp 227f6b
  	dollar_vcol = curwin->w_virtcol;
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
  #ifdef FEAT_FOLDING
Karsten Hopp 227f6b
--- 8961,8967 ----
Karsten Hopp 227f6b
       * We can emulate the vi behaviour by pretending there is a dollar
Karsten Hopp 227f6b
       * displayed even when there isn't.
Karsten Hopp 227f6b
       *  --pkv Sun Jan 19 01:56:40 EST 2003 */
Karsten Hopp 227f6b
!     if (vim_strchr(p_cpo, CPO_BACKSPACE) != NULL && dollar_vcol == -1)
Karsten Hopp 227f6b
  	dollar_vcol = curwin->w_virtcol;
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
  #ifdef FEAT_FOLDING
Karsten Hopp 227f6b
*** ../vim-7.3.425/src/globals.h	2011-05-10 16:41:13.000000000 +0200
Karsten Hopp 227f6b
--- src/globals.h	2012-02-04 23:24:07.000000000 +0100
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 113,121 ****
Karsten Hopp 227f6b
   * When '$' is included in 'cpoptions' option set:
Karsten Hopp 227f6b
   * When a change command is given that deletes only part of a line, a dollar
Karsten Hopp 227f6b
   * is put at the end of the changed text. dollar_vcol is set to the virtual
Karsten Hopp 227f6b
!  * column of this '$'.
Karsten Hopp 227f6b
   */
Karsten Hopp 227f6b
! EXTERN colnr_T	dollar_vcol INIT(= 0);
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
  #ifdef FEAT_INS_EXPAND
Karsten Hopp 227f6b
  /*
Karsten Hopp 227f6b
--- 113,121 ----
Karsten Hopp 227f6b
   * When '$' is included in 'cpoptions' option set:
Karsten Hopp 227f6b
   * When a change command is given that deletes only part of a line, a dollar
Karsten Hopp 227f6b
   * is put at the end of the changed text. dollar_vcol is set to the virtual
Karsten Hopp 227f6b
!  * column of this '$'.  -1 is used to indicate no $ is being displayed.
Karsten Hopp 227f6b
   */
Karsten Hopp 227f6b
! EXTERN colnr_T	dollar_vcol INIT(= -1);
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
  #ifdef FEAT_INS_EXPAND
Karsten Hopp 227f6b
  /*
Karsten Hopp 227f6b
*** ../vim-7.3.425/src/move.c	2012-01-10 22:26:12.000000000 +0100
Karsten Hopp 227f6b
--- src/move.c	2012-02-04 23:21:08.000000000 +0100
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 362,368 ****
Karsten Hopp 227f6b
  #endif
Karsten Hopp 227f6b
  	    )
Karsten Hopp 227f6b
      {
Karsten Hopp 227f6b
! 	dollar_vcol = 0;
Karsten Hopp 227f6b
  	if (curwin->w_skipcol != 0)
Karsten Hopp 227f6b
  	{
Karsten Hopp 227f6b
  	    curwin->w_skipcol = 0;
Karsten Hopp 227f6b
--- 362,368 ----
Karsten Hopp 227f6b
  #endif
Karsten Hopp 227f6b
  	    )
Karsten Hopp 227f6b
      {
Karsten Hopp 227f6b
! 	dollar_vcol = -1;
Karsten Hopp 227f6b
  	if (curwin->w_skipcol != 0)
Karsten Hopp 227f6b
  	{
Karsten Hopp 227f6b
  	    curwin->w_skipcol = 0;
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 966,972 ****
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
      /* remove '$' from change command when cursor moves onto it */
Karsten Hopp 227f6b
      if (startcol > dollar_vcol)
Karsten Hopp 227f6b
! 	dollar_vcol = 0;
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
      extra = curwin_col_off();
Karsten Hopp 227f6b
      curwin->w_wcol = curwin->w_virtcol + extra;
Karsten Hopp 227f6b
--- 966,972 ----
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
      /* remove '$' from change command when cursor moves onto it */
Karsten Hopp 227f6b
      if (startcol > dollar_vcol)
Karsten Hopp 227f6b
! 	dollar_vcol = -1;
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
      extra = curwin_col_off();
Karsten Hopp 227f6b
      curwin->w_wcol = curwin->w_virtcol + extra;
Karsten Hopp 227f6b
*** ../vim-7.3.425/src/screen.c	2012-01-10 22:26:12.000000000 +0100
Karsten Hopp 227f6b
--- src/screen.c	2012-02-04 23:22:44.000000000 +0100
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 1637,1647 ****
Karsten Hopp 227f6b
  	     * When at start of changed lines: May scroll following lines
Karsten Hopp 227f6b
  	     * up or down to minimize redrawing.
Karsten Hopp 227f6b
  	     * Don't do this when the change continues until the end.
Karsten Hopp 227f6b
! 	     * Don't scroll when dollar_vcol is non-zero, keep the "$".
Karsten Hopp 227f6b
  	     */
Karsten Hopp 227f6b
  	    if (lnum == mod_top
Karsten Hopp 227f6b
  		    && mod_bot != MAXLNUM
Karsten Hopp 227f6b
! 		    && !(dollar_vcol != 0 && mod_bot == mod_top + 1))
Karsten Hopp 227f6b
  	    {
Karsten Hopp 227f6b
  		int		old_rows = 0;
Karsten Hopp 227f6b
  		int		new_rows = 0;
Karsten Hopp 227f6b
--- 1637,1647 ----
Karsten Hopp 227f6b
  	     * When at start of changed lines: May scroll following lines
Karsten Hopp 227f6b
  	     * up or down to minimize redrawing.
Karsten Hopp 227f6b
  	     * Don't do this when the change continues until the end.
Karsten Hopp 227f6b
! 	     * Don't scroll when dollar_vcol >= 0, keep the "$".
Karsten Hopp 227f6b
  	     */
Karsten Hopp 227f6b
  	    if (lnum == mod_top
Karsten Hopp 227f6b
  		    && mod_bot != MAXLNUM
Karsten Hopp 227f6b
! 		    && !(dollar_vcol >= 0 && mod_bot == mod_top + 1))
Karsten Hopp 227f6b
  	    {
Karsten Hopp 227f6b
  		int		old_rows = 0;
Karsten Hopp 227f6b
  		int		new_rows = 0;
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 1868,1879 ****
Karsten Hopp 227f6b
  	    if (row > wp->w_height)	/* past end of screen */
Karsten Hopp 227f6b
  	    {
Karsten Hopp 227f6b
  		/* we may need the size of that too long line later on */
Karsten Hopp 227f6b
! 		if (dollar_vcol == 0)
Karsten Hopp 227f6b
  		    wp->w_lines[idx].wl_size = plines_win(wp, lnum, TRUE);
Karsten Hopp 227f6b
  		++idx;
Karsten Hopp 227f6b
  		break;
Karsten Hopp 227f6b
  	    }
Karsten Hopp 227f6b
! 	    if (dollar_vcol == 0)
Karsten Hopp 227f6b
  		wp->w_lines[idx].wl_size = row - srow;
Karsten Hopp 227f6b
  	    ++idx;
Karsten Hopp 227f6b
  #ifdef FEAT_FOLDING
Karsten Hopp 227f6b
--- 1868,1879 ----
Karsten Hopp 227f6b
  	    if (row > wp->w_height)	/* past end of screen */
Karsten Hopp 227f6b
  	    {
Karsten Hopp 227f6b
  		/* we may need the size of that too long line later on */
Karsten Hopp 227f6b
! 		if (dollar_vcol == -1)
Karsten Hopp 227f6b
  		    wp->w_lines[idx].wl_size = plines_win(wp, lnum, TRUE);
Karsten Hopp 227f6b
  		++idx;
Karsten Hopp 227f6b
  		break;
Karsten Hopp 227f6b
  	    }
Karsten Hopp 227f6b
! 	    if (dollar_vcol == -1)
Karsten Hopp 227f6b
  		wp->w_lines[idx].wl_size = row - srow;
Karsten Hopp 227f6b
  	    ++idx;
Karsten Hopp 227f6b
  #ifdef FEAT_FOLDING
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 1990,1996 ****
Karsten Hopp 227f6b
  	    }
Karsten Hopp 227f6b
  #endif
Karsten Hopp 227f6b
  	}
Karsten Hopp 227f6b
! 	else if (dollar_vcol == 0)
Karsten Hopp 227f6b
  	    wp->w_botline = lnum;
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
  	/* make sure the rest of the screen is blank */
Karsten Hopp 227f6b
--- 1990,1996 ----
Karsten Hopp 227f6b
  	    }
Karsten Hopp 227f6b
  #endif
Karsten Hopp 227f6b
  	}
Karsten Hopp 227f6b
! 	else if (dollar_vcol == -1)
Karsten Hopp 227f6b
  	    wp->w_botline = lnum;
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
  	/* make sure the rest of the screen is blank */
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 2005,2011 ****
Karsten Hopp 227f6b
      wp->w_old_botfill = wp->w_botfill;
Karsten Hopp 227f6b
  #endif
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
!     if (dollar_vcol == 0)
Karsten Hopp 227f6b
      {
Karsten Hopp 227f6b
  	/*
Karsten Hopp 227f6b
  	 * There is a trick with w_botline.  If we invalidate it on each
Karsten Hopp 227f6b
--- 2005,2011 ----
Karsten Hopp 227f6b
      wp->w_old_botfill = wp->w_botfill;
Karsten Hopp 227f6b
  #endif
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
!     if (dollar_vcol == -1)
Karsten Hopp 227f6b
      {
Karsten Hopp 227f6b
  	/*
Karsten Hopp 227f6b
  	 * There is a trick with w_botline.  If we invalidate it on each
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 3564,3570 ****
Karsten Hopp 227f6b
  	}
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
  	/* When still displaying '$' of change command, stop at cursor */
Karsten Hopp 227f6b
! 	if (dollar_vcol != 0 && wp == curwin
Karsten Hopp 227f6b
  		   && lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol
Karsten Hopp 227f6b
  #ifdef FEAT_DIFF
Karsten Hopp 227f6b
  				   && filler_todo <= 0
Karsten Hopp 227f6b
--- 3564,3570 ----
Karsten Hopp 227f6b
  	}
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
  	/* When still displaying '$' of change command, stop at cursor */
Karsten Hopp 227f6b
! 	if (dollar_vcol >= 0 && wp == curwin
Karsten Hopp 227f6b
  		   && lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol
Karsten Hopp 227f6b
  #ifdef FEAT_DIFF
Karsten Hopp 227f6b
  				   && filler_todo <= 0
Karsten Hopp 227f6b
*** ../vim-7.3.425/src/search.c	2012-01-26 20:58:21.000000000 +0100
Karsten Hopp 227f6b
--- src/search.c	2012-02-04 23:23:10.000000000 +0100
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 2501,2508 ****
Karsten Hopp 227f6b
  	    save_siso = p_siso;
Karsten Hopp 227f6b
  	    /* Handle "$" in 'cpo': If the ')' is typed on top of the "$",
Karsten Hopp 227f6b
  	     * stop displaying the "$". */
Karsten Hopp 227f6b
! 	    if (dollar_vcol > 0 && dollar_vcol == curwin->w_virtcol)
Karsten Hopp 227f6b
! 		dollar_vcol = 0;
Karsten Hopp 227f6b
  	    ++curwin->w_virtcol;	/* do display ')' just before "$" */
Karsten Hopp 227f6b
  	    update_screen(VALID);	/* show the new char first */
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
--- 2501,2508 ----
Karsten Hopp 227f6b
  	    save_siso = p_siso;
Karsten Hopp 227f6b
  	    /* Handle "$" in 'cpo': If the ')' is typed on top of the "$",
Karsten Hopp 227f6b
  	     * stop displaying the "$". */
Karsten Hopp 227f6b
! 	    if (dollar_vcol >= 0 && dollar_vcol == curwin->w_virtcol)
Karsten Hopp 227f6b
! 		dollar_vcol = -1;
Karsten Hopp 227f6b
  	    ++curwin->w_virtcol;	/* do display ')' just before "$" */
Karsten Hopp 227f6b
  	    update_screen(VALID);	/* show the new char first */
Karsten Hopp 227f6b
  
Karsten Hopp 227f6b
*** ../vim-7.3.425/src/version.c	2012-02-04 22:44:27.000000000 +0100
Karsten Hopp 227f6b
--- src/version.c	2012-02-04 23:32:55.000000000 +0100
Karsten Hopp 227f6b
***************
Karsten Hopp 227f6b
*** 716,717 ****
Karsten Hopp 227f6b
--- 716,719 ----
Karsten Hopp 227f6b
  {   /* Add new patch number below this line */
Karsten Hopp 227f6b
+ /**/
Karsten Hopp 227f6b
+     426,
Karsten Hopp 227f6b
  /**/
Karsten Hopp 227f6b
Karsten Hopp 227f6b
Karsten Hopp 227f6b
-- 
Karsten Hopp 227f6b
I am also told that there is a logical proof out there somewhere
Karsten Hopp 227f6b
that demonstrates that there is no task which duct tape cannot handle.
Karsten Hopp 227f6b
					-- Paul Brannan
Karsten Hopp 227f6b
Karsten Hopp 227f6b
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 227f6b
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 227f6b
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 227f6b
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///