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