Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.4.417
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.4.417
Problem:    After splitting a window and setting 'breakindent' the default
	    minimum with is not respected.
Solution:   Call briopt_check() when copying options to a new window.
Files:	    src/option.c, src/proto/option.pro,
	    src/testdir/test_breakindent.in


*** ../vim-7.4.416/src/option.c	2014-08-13 21:58:24.820885492 +0200
--- src/option.c	2014-08-24 21:30:49.468546394 +0200
***************
*** 3097,3102 ****
--- 3097,3105 ----
  static int opt_strings_flags __ARGS((char_u *val, char **values, unsigned *flagp, int list));
  static int check_opt_strings __ARGS((char_u *val, char **values, int));
  static int check_opt_wim __ARGS((void));
+ #ifdef FEAT_LINEBREAK
+ static int briopt_check __ARGS((win_T *wp));
+ #endif
  
  /*
   * Initialize the options, first part.
***************
*** 5289,5295 ****
      (void)check_cedit();
  #endif
  #ifdef FEAT_LINEBREAK
!     briopt_check();
  #endif
  }
  
--- 5292,5298 ----
      (void)check_cedit();
  #endif
  #ifdef FEAT_LINEBREAK
!     briopt_check(curwin);
  #endif
  }
  
***************
*** 5748,5754 ****
      /* 'breakindentopt' */
      else if (varp == &curwin->w_p_briopt)
      {
! 	if (briopt_check() == FAIL)
  	    errmsg = e_invarg;
      }
  #endif
--- 5751,5757 ----
      /* 'breakindentopt' */
      else if (varp == &curwin->w_p_briopt)
      {
! 	if (briopt_check(curwin) == FAIL)
  	    errmsg = e_invarg;
      }
  #endif
***************
*** 10232,10237 ****
--- 10235,10243 ----
      wp_to->w_farsi = wp_from->w_farsi;
  #  endif
  # endif
+ #if defined(FEAT_LINEBREAK)
+     briopt_check(wp_to);
+ #endif
  }
  #endif
  
***************
*** 12002,12016 ****
   * This is called when 'breakindentopt' is changed and when a window is
   * initialized.
   */
!     int
! briopt_check()
  {
      char_u	*p;
      int		bri_shift = 0;
      long	bri_min = 20;
      int		bri_sbr = FALSE;
  
!     p = curwin->w_p_briopt;
      while (*p != NUL)
      {
  	if (STRNCMP(p, "shift:", 6) == 0
--- 12008,12023 ----
   * This is called when 'breakindentopt' is changed and when a window is
   * initialized.
   */
!     static int
! briopt_check(wp)
!     win_T *wp;
  {
      char_u	*p;
      int		bri_shift = 0;
      long	bri_min = 20;
      int		bri_sbr = FALSE;
  
!     p = wp->w_p_briopt;
      while (*p != NUL)
      {
  	if (STRNCMP(p, "shift:", 6) == 0
***************
*** 12035,12043 ****
  	    ++p;
      }
  
!     curwin->w_p_brishift = bri_shift;
!     curwin->w_p_brimin   = bri_min;
!     curwin->w_p_brisbr   = bri_sbr;
  
      return OK;
  }
--- 12042,12050 ----
  	    ++p;
      }
  
!     wp->w_p_brishift = bri_shift;
!     wp->w_p_brimin   = bri_min;
!     wp->w_p_brisbr   = bri_sbr;
  
      return OK;
  }
*** ../vim-7.4.416/src/proto/option.pro	2014-06-25 14:44:04.458358774 +0200
--- src/proto/option.pro	2014-08-24 21:30:53.588546244 +0200
***************
*** 62,66 ****
  long get_sw_value __ARGS((buf_T *buf));
  long get_sts_value __ARGS((void));
  void find_mps_values __ARGS((int *initc, int *findc, int *backwards, int switchit));
- int briopt_check __ARGS((void));
  /* vim: set ft=c : */
--- 62,65 ----
*** ../vim-7.4.416/src/testdir/test_breakindent.in	2014-08-24 21:19:22.220571318 +0200
--- src/testdir/test_breakindent.in	2014-08-24 21:37:40.616531483 +0200
***************
*** 27,32 ****
--- 27,33 ----
  :	$put =g:line1
  :	wincmd p
  :endfu
+ :set briopt=min:0
  :let g:test="Test 1: Simple breakindent"
  :let line1=ScreenChar(8)
  :call DoRecordScreen()
*** ../vim-7.4.416/src/version.c	2014-08-24 21:19:22.224571318 +0200
--- src/version.c	2014-08-24 21:29:09.156550032 +0200
***************
*** 743,744 ****
--- 743,746 ----
  {   /* Add new patch number below this line */
+ /**/
+     417,
  /**/


-- 
hundred-and-one symptoms of being an internet addict:
58. You turn on your computer and turn off your wife.

 /// 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    ///