Karsten Hopp 1a1f48
To: vim_dev@googlegroups.com
Karsten Hopp 1a1f48
Subject: Patch 7.3.693
Karsten Hopp 1a1f48
Fcc: outbox
Karsten Hopp 1a1f48
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 1a1f48
Mime-Version: 1.0
Karsten Hopp 1a1f48
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 1a1f48
Content-Transfer-Encoding: 8bit
Karsten Hopp 1a1f48
------------
Karsten Hopp 1a1f48
Karsten Hopp 1a1f48
Patch 7.3.693
Karsten Hopp 1a1f48
Problem:    Can't make 'softtabstop' follow 'shiftwidth'.
Karsten Hopp 1a1f48
Solution:   When 'softtabstop' is negative use the value of 'shiftwidth'.
Karsten Hopp 1a1f48
            (so8res)
Karsten Hopp 1a1f48
Files:      src/edit.c, src/option.c, src/proto/option.pro
Karsten Hopp 1a1f48
Karsten Hopp 1a1f48
Karsten Hopp 1a1f48
*** ../vim-7.3.692/src/edit.c	2012-10-04 22:38:32.000000000 +0200
Karsten Hopp 1a1f48
--- src/edit.c	2012-10-21 00:01:53.000000000 +0200
Karsten Hopp 1a1f48
***************
Karsten Hopp 1a1f48
*** 8885,8891 ****
Karsten Hopp 1a1f48
  	 */
Karsten Hopp 1a1f48
  	if (	   mode == BACKSPACE_CHAR
Karsten Hopp 1a1f48
  		&& ((p_sta && in_indent)
Karsten Hopp 1a1f48
! 		    || (curbuf->b_p_sts != 0
Karsten Hopp 1a1f48
  			&& curwin->w_cursor.col > 0
Karsten Hopp 1a1f48
  			&& (*(ml_get_cursor() - 1) == TAB
Karsten Hopp 1a1f48
  			    || (*(ml_get_cursor() - 1) == ' '
Karsten Hopp 1a1f48
--- 8885,8891 ----
Karsten Hopp 1a1f48
  	 */
Karsten Hopp 1a1f48
  	if (	   mode == BACKSPACE_CHAR
Karsten Hopp 1a1f48
  		&& ((p_sta && in_indent)
Karsten Hopp 1a1f48
! 		    || (get_sts_value() != 0
Karsten Hopp 1a1f48
  			&& curwin->w_cursor.col > 0
Karsten Hopp 1a1f48
  			&& (*(ml_get_cursor() - 1) == TAB
Karsten Hopp 1a1f48
  			    || (*(ml_get_cursor() - 1) == ' '
Karsten Hopp 1a1f48
***************
Karsten Hopp 1a1f48
*** 8901,8907 ****
Karsten Hopp 1a1f48
  	    if (p_sta && in_indent)
Karsten Hopp 1a1f48
  		ts = (int)get_sw_value();
Karsten Hopp 1a1f48
  	    else
Karsten Hopp 1a1f48
! 		ts = (int)curbuf->b_p_sts;
Karsten Hopp 1a1f48
  	    /* Compute the virtual column where we want to be.  Since
Karsten Hopp 1a1f48
  	     * 'showbreak' may get in the way, need to get the last column of
Karsten Hopp 1a1f48
  	     * the previous character. */
Karsten Hopp 1a1f48
--- 8901,8907 ----
Karsten Hopp 1a1f48
  	    if (p_sta && in_indent)
Karsten Hopp 1a1f48
  		ts = (int)get_sw_value();
Karsten Hopp 1a1f48
  	    else
Karsten Hopp 1a1f48
! 		ts = (int)get_sts_value();
Karsten Hopp 1a1f48
  	    /* Compute the virtual column where we want to be.  Since
Karsten Hopp 1a1f48
  	     * 'showbreak' may get in the way, need to get the last column of
Karsten Hopp 1a1f48
  	     * the previous character. */
Karsten Hopp 1a1f48
***************
Karsten Hopp 1a1f48
*** 9590,9596 ****
Karsten Hopp 1a1f48
       */
Karsten Hopp 1a1f48
      if (!curbuf->b_p_et
Karsten Hopp 1a1f48
  	    && !(p_sta && ind && curbuf->b_p_ts != get_sw_value())
Karsten Hopp 1a1f48
! 	    && curbuf->b_p_sts == 0)
Karsten Hopp 1a1f48
  	return TRUE;
Karsten Hopp 1a1f48
  
Karsten Hopp 1a1f48
      if (stop_arrow() == FAIL)
Karsten Hopp 1a1f48
--- 9590,9596 ----
Karsten Hopp 1a1f48
       */
Karsten Hopp 1a1f48
      if (!curbuf->b_p_et
Karsten Hopp 1a1f48
  	    && !(p_sta && ind && curbuf->b_p_ts != get_sw_value())
Karsten Hopp 1a1f48
! 	    && get_sts_value() == 0)
Karsten Hopp 1a1f48
  	return TRUE;
Karsten Hopp 1a1f48
  
Karsten Hopp 1a1f48
      if (stop_arrow() == FAIL)
Karsten Hopp 1a1f48
***************
Karsten Hopp 1a1f48
*** 9606,9613 ****
Karsten Hopp 1a1f48
  
Karsten Hopp 1a1f48
      if (p_sta && ind)		/* insert tab in indent, use 'shiftwidth' */
Karsten Hopp 1a1f48
  	temp = (int)get_sw_value();
Karsten Hopp 1a1f48
!     else if (curbuf->b_p_sts > 0) /* use 'softtabstop' when set */
Karsten Hopp 1a1f48
! 	temp = (int)curbuf->b_p_sts;
Karsten Hopp 1a1f48
      else			/* otherwise use 'tabstop' */
Karsten Hopp 1a1f48
  	temp = (int)curbuf->b_p_ts;
Karsten Hopp 1a1f48
      temp -= get_nolist_virtcol() % temp;
Karsten Hopp 1a1f48
--- 9606,9613 ----
Karsten Hopp 1a1f48
  
Karsten Hopp 1a1f48
      if (p_sta && ind)		/* insert tab in indent, use 'shiftwidth' */
Karsten Hopp 1a1f48
  	temp = (int)get_sw_value();
Karsten Hopp 1a1f48
!     else if (curbuf->b_p_sts != 0) /* use 'softtabstop' when set */
Karsten Hopp 1a1f48
! 	temp = (int)get_sts_value();
Karsten Hopp 1a1f48
      else			/* otherwise use 'tabstop' */
Karsten Hopp 1a1f48
  	temp = (int)curbuf->b_p_ts;
Karsten Hopp 1a1f48
      temp -= get_nolist_virtcol() % temp;
Karsten Hopp 1a1f48
***************
Karsten Hopp 1a1f48
*** 9635,9641 ****
Karsten Hopp 1a1f48
      /*
Karsten Hopp 1a1f48
       * When 'expandtab' not set: Replace spaces by TABs where possible.
Karsten Hopp 1a1f48
       */
Karsten Hopp 1a1f48
!     if (!curbuf->b_p_et && (curbuf->b_p_sts || (p_sta && ind)))
Karsten Hopp 1a1f48
      {
Karsten Hopp 1a1f48
  	char_u		*ptr;
Karsten Hopp 1a1f48
  #ifdef FEAT_VREPLACE
Karsten Hopp 1a1f48
--- 9635,9641 ----
Karsten Hopp 1a1f48
      /*
Karsten Hopp 1a1f48
       * When 'expandtab' not set: Replace spaces by TABs where possible.
Karsten Hopp 1a1f48
       */
Karsten Hopp 1a1f48
!     if (!curbuf->b_p_et && (get_sts_value() || (p_sta && ind)))
Karsten Hopp 1a1f48
      {
Karsten Hopp 1a1f48
  	char_u		*ptr;
Karsten Hopp 1a1f48
  #ifdef FEAT_VREPLACE
Karsten Hopp 1a1f48
*** ../vim-7.3.692/src/option.c	2012-08-08 18:01:00.000000000 +0200
Karsten Hopp 1a1f48
--- src/option.c	2012-10-21 00:05:06.000000000 +0200
Karsten Hopp 1a1f48
***************
Karsten Hopp 1a1f48
*** 8509,8519 ****
Karsten Hopp 1a1f48
  	    p_window = Rows - 1;
Karsten Hopp 1a1f48
      }
Karsten Hopp 1a1f48
  
Karsten Hopp 1a1f48
-     if (curbuf->b_p_sts < 0)
Karsten Hopp 1a1f48
-     {
Karsten Hopp 1a1f48
- 	errmsg = e_positive;
Karsten Hopp 1a1f48
- 	curbuf->b_p_sts = 0;
Karsten Hopp 1a1f48
-     }
Karsten Hopp 1a1f48
      if (curbuf->b_p_ts <= 0)
Karsten Hopp 1a1f48
      {
Karsten Hopp 1a1f48
  	errmsg = e_positive;
Karsten Hopp 1a1f48
--- 8509,8514 ----
Karsten Hopp 1a1f48
***************
Karsten Hopp 1a1f48
*** 11429,11431 ****
Karsten Hopp 1a1f48
--- 11424,11436 ----
Karsten Hopp 1a1f48
  {
Karsten Hopp 1a1f48
      return curbuf->b_p_sw ? curbuf->b_p_sw : curbuf->b_p_ts;
Karsten Hopp 1a1f48
  }
Karsten Hopp 1a1f48
+ 
Karsten Hopp 1a1f48
+ /*
Karsten Hopp 1a1f48
+  * Return the effective softtabstop value for the current buffer, using the
Karsten Hopp 1a1f48
+  * 'tabstop' value when 'softtabstop' is negative.
Karsten Hopp 1a1f48
+  */
Karsten Hopp 1a1f48
+     long
Karsten Hopp 1a1f48
+ get_sts_value()
Karsten Hopp 1a1f48
+ {
Karsten Hopp 1a1f48
+     return curbuf->b_p_sts < 0 ? get_sw_value() : curbuf->b_p_sts;
Karsten Hopp 1a1f48
+ }
Karsten Hopp 1a1f48
*** ../vim-7.3.692/src/proto/option.pro	2012-08-08 18:01:00.000000000 +0200
Karsten Hopp 1a1f48
--- src/proto/option.pro	2012-10-21 00:01:59.000000000 +0200
Karsten Hopp 1a1f48
***************
Karsten Hopp 1a1f48
*** 57,60 ****
Karsten Hopp 1a1f48
--- 57,61 ----
Karsten Hopp 1a1f48
  int file_ff_differs __ARGS((buf_T *buf, int ignore_empty));
Karsten Hopp 1a1f48
  int check_ff_value __ARGS((char_u *p));
Karsten Hopp 1a1f48
  long get_sw_value __ARGS((void));
Karsten Hopp 1a1f48
+ long get_sts_value __ARGS((void));
Karsten Hopp 1a1f48
  /* vim: set ft=c : */
Karsten Hopp 1a1f48
*** ../vim-7.3.692/src/version.c	2012-10-18 05:18:27.000000000 +0200
Karsten Hopp 1a1f48
--- src/version.c	2012-10-21 00:07:19.000000000 +0200
Karsten Hopp 1a1f48
***************
Karsten Hopp 1a1f48
*** 721,722 ****
Karsten Hopp 1a1f48
--- 721,724 ----
Karsten Hopp 1a1f48
  {   /* Add new patch number below this line */
Karsten Hopp 1a1f48
+ /**/
Karsten Hopp 1a1f48
+     693,
Karsten Hopp 1a1f48
  /**/
Karsten Hopp 1a1f48
Karsten Hopp 1a1f48
-- 
Karsten Hopp 1a1f48
FIRST VILLAGER: We have found a witch.  May we burn her?
Karsten Hopp 1a1f48
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 1a1f48
Karsten Hopp 1a1f48
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 1a1f48
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 1a1f48
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 1a1f48
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///