jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone
073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.338
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.338
073263
Problem:    Cannot wrap lines taking indent into account.
073263
Solution:   Add the 'breakindent' option. (many authors, final improvements by
073263
	    Christian Brabandt)
073263
Files:	    runtime/doc/eval.txt, runtime/doc/options.txt, runtime/optwin.vim,
073263
	    src/buffer.c, src/charset.c, src/edit.c, src/ex_getln.c,
073263
	    src/getchar.c, src/misc1.c, src/misc2.c, src/ops.c, src/option.c,
073263
	    src/option.h, src/proto/charset.pro, src/proto/misc1.pro,
073263
	    src/proto/option.pro, src/screen.c, src/structs.h,
073263
	    src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak,
073263
	    src/testdir/Make_ming.mak, src/testdir/Make_os2.mak,
073263
	    src/testdir/Make_vms.mms, src/testdir/Makefile,
073263
	    src/testdir/test_breakindent.in, src/testdir/test_breakindent.ok,
073263
	    src/ui.c
073263
073263
073263
*** ../vim-7.4.337/runtime/doc/eval.txt	2014-06-17 17:48:21.768628007 +0200
073263
--- runtime/doc/eval.txt	2014-06-25 12:57:00.986115765 +0200
073263
***************
073263
*** 6639,6646 ****
073263
  keymap			Compiled with 'keymap' support.
073263
  langmap			Compiled with 'langmap' support.
073263
  libcall			Compiled with |libcall()| support.
073263
! linebreak		Compiled with 'linebreak', 'breakat' and 'showbreak'
073263
! 			support.
073263
  lispindent		Compiled with support for lisp indenting.
073263
  listcmds		Compiled with commands for the buffer list |:files|
073263
  			and the argument list |arglist|.
073263
--- 6651,6658 ----
073263
  keymap			Compiled with 'keymap' support.
073263
  langmap			Compiled with 'langmap' support.
073263
  libcall			Compiled with |libcall()| support.
073263
! linebreak		Compiled with 'linebreak', 'breakat', 'showbreak' and
073263
! 			'breakindent' support.
073263
  lispindent		Compiled with support for lisp indenting.
073263
  listcmds		Compiled with commands for the buffer list |:files|
073263
  			and the argument list |arglist|.
073263
*** ../vim-7.4.337/runtime/doc/options.txt	2014-06-17 17:48:21.768628007 +0200
073263
--- runtime/doc/options.txt	2014-06-25 12:57:00.986115765 +0200
073263
***************
073263
*** 1200,1205 ****
073263
--- 1200,1237 ----
073263
  	break if 'linebreak' is on.  Only works for ASCII and also for 8-bit
073263
  	characters when 'encoding' is an 8-bit encoding.
073263
  
073263
+ 						*'breakindent'* *'bri'*
073263
+ 'breakindent' 'bri'	boolean (default off)
073263
+ 			local to window
073263
+ 			{not in Vi}
073263
+ 			{not available when compiled without the |+linebreak|
073263
+ 			feature}
073263
+ 	Every wrapped line will continue visually indented (same amount of
073263
+ 	space as the beginning of that line), thus preserving horizontal blocks
073263
+ 	of text.
073263
+ 
073263
+ 						*'breakindentopt'* *'briopt'*
073263
+ 'breakindentopt' 'briopt' string (default empty)
073263
+ 			local to window
073263
+ 			{not in Vi}
073263
+ 			{not available when compiled without the |+linebreak|
073263
+ 			feature}
073263
+ 	Settings for 'breakindent'. It can consist of the following optional
073263
+ 	items and must be seperated by a comma:
073263
+ 		min:{n}	    Minimum text width that will be kept after
073263
+ 			    applying 'breakindent', even if the resulting
073263
+ 			    text should normally be narrower. This prevents
073263
+ 			    text indented almost to the right window border
073263
+ 			    occupying lot of vertical space when broken.
073263
+ 		shift:{n}   After applying 'breakindent', wrapped line
073263
+ 			    beginning will be shift by given number of
073263
+ 			    characters. It permits dynamic French paragraph
073263
+ 			    indentation (negative) or emphasizing the line
073263
+ 			    continuation (positive).
073263
+ 		sbr	    Display the 'showbreak' value before applying the 
073263
+ 			    additional indent.
073263
+ 	The default value for min is 20 and shift is 0.
073263
+ 
073263
  						*'browsedir'* *'bsdir'*
073263
  'browsedir' 'bsdir'	string	(default: "last")
073263
  			global
073263
*** ../vim-7.4.337/runtime/optwin.vim	2014-04-01 12:26:40.241157964 +0200
073263
--- runtime/optwin.vim	2014-06-25 12:57:00.990115765 +0200
073263
***************
073263
*** 324,329 ****
073263
--- 324,335 ----
073263
  call append("$", "linebreak\twrap long lines at a character in 'breakat'")
073263
  call append("$", "\t(local to window)")
073263
  call <SID>BinOptionL("lbr")
073263
+ call append("$", "breakindent\tpreserve indentation in wrapped text")
073263
+ call append("$", "\t(local to window)")
073263
+ call <SID>BinOptionL("bri")
073263
+ call append("$", "breakindentopt\tadjust breakindent behaviour")
073263
+ call append("$", "\t(local to window)")
073263
+ call <SID>OptionL("briopt")
073263
  call append("$", "breakat\twhich characters might cause a line break")
073263
  call <SID>OptionG("brk", &brk)
073263
  call append("$", "showbreak\tstring to put before wrapped screen lines")
073263
*** ../vim-7.4.337/src/charset.c	2014-03-23 15:12:29.911264336 +0100
073263
--- src/charset.c	2014-06-25 13:23:05.842174966 +0200
073263
***************
073263
*** 867,875 ****
073263
      char_u	*s;
073263
  {
073263
      colnr_T	col = startcol;
073263
  
073263
      while (*s != NUL)
073263
! 	col += lbr_chartabsize_adv(&s, col);
073263
      return (int)col;
073263
  }
073263
  
073263
--- 867,876 ----
073263
      char_u	*s;
073263
  {
073263
      colnr_T	col = startcol;
073263
+     char_u	*line = s; /* pointer to start of line, for breakindent */
073263
  
073263
      while (*s != NUL)
073263
! 	col += lbr_chartabsize_adv(line, &s, col);
073263
      return (int)col;
073263
  }
073263
  
073263
***************
073263
*** 877,892 ****
073263
   * Like linetabsize(), but for a given window instead of the current one.
073263
   */
073263
      int
073263
! win_linetabsize(wp, p, len)
073263
      win_T	*wp;
073263
!     char_u	*p;
073263
      colnr_T	len;
073263
  {
073263
      colnr_T	col = 0;
073263
      char_u	*s;
073263
  
073263
!     for (s = p; *s != NUL && (len == MAXCOL || s < p + len); mb_ptr_adv(s))
073263
! 	col += win_lbr_chartabsize(wp, s, col, NULL);
073263
      return (int)col;
073263
  }
073263
  
073263
--- 878,894 ----
073263
   * Like linetabsize(), but for a given window instead of the current one.
073263
   */
073263
      int
073263
! win_linetabsize(wp, line, len)
073263
      win_T	*wp;
073263
!     char_u	*line;
073263
      colnr_T	len;
073263
  {
073263
      colnr_T	col = 0;
073263
      char_u	*s;
073263
  
073263
!     for (s = line; *s != NUL && (len == MAXCOL || s < line + len);
073263
! 								mb_ptr_adv(s))
073263
! 	col += win_lbr_chartabsize(wp, line, s, col, NULL);
073263
      return (int)col;
073263
  }
073263
  
073263
***************
073263
*** 1021,1032 ****
073263
   * like chartabsize(), but also check for line breaks on the screen
073263
   */
073263
      int
073263
! lbr_chartabsize(s, col)
073263
      unsigned char	*s;
073263
      colnr_T		col;
073263
  {
073263
  #ifdef FEAT_LINEBREAK
073263
!     if (!curwin->w_p_lbr && *p_sbr == NUL)
073263
      {
073263
  #endif
073263
  #ifdef FEAT_MBYTE
073263
--- 1023,1035 ----
073263
   * like chartabsize(), but also check for line breaks on the screen
073263
   */
073263
      int
073263
! lbr_chartabsize(line, s, col)
073263
!     char_u		*line; /* start of the line */
073263
      unsigned char	*s;
073263
      colnr_T		col;
073263
  {
073263
  #ifdef FEAT_LINEBREAK
073263
!     if (!curwin->w_p_lbr && *p_sbr == NUL && !curwin->w_p_bri)
073263
      {
073263
  #endif
073263
  #ifdef FEAT_MBYTE
073263
***************
073263
*** 1036,1042 ****
073263
  	RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col)
073263
  #ifdef FEAT_LINEBREAK
073263
      }
073263
!     return win_lbr_chartabsize(curwin, s, col, NULL);
073263
  #endif
073263
  }
073263
  
073263
--- 1039,1045 ----
073263
  	RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col)
073263
  #ifdef FEAT_LINEBREAK
073263
      }
073263
!     return win_lbr_chartabsize(curwin, line == NULL ? s : line, s, col, NULL);
073263
  #endif
073263
  }
073263
  
073263
***************
073263
*** 1044,1056 ****
073263
   * Call lbr_chartabsize() and advance the pointer.
073263
   */
073263
      int
073263
! lbr_chartabsize_adv(s, col)
073263
      char_u	**s;
073263
      colnr_T	col;
073263
  {
073263
      int		retval;
073263
  
073263
!     retval = lbr_chartabsize(*s, col);
073263
      mb_ptr_adv(*s);
073263
      return retval;
073263
  }
073263
--- 1047,1060 ----
073263
   * Call lbr_chartabsize() and advance the pointer.
073263
   */
073263
      int
073263
! lbr_chartabsize_adv(line, s, col)
073263
!     char_u	*line; /* start of the line */
073263
      char_u	**s;
073263
      colnr_T	col;
073263
  {
073263
      int		retval;
073263
  
073263
!     retval = lbr_chartabsize(line, *s, col);
073263
      mb_ptr_adv(*s);
073263
      return retval;
073263
  }
073263
***************
073263
*** 1063,1070 ****
073263
   * value, init to 0 before calling.
073263
   */
073263
      int
073263
! win_lbr_chartabsize(wp, s, col, headp)
073263
      win_T	*wp;
073263
      char_u	*s;
073263
      colnr_T	col;
073263
      int		*headp UNUSED;
073263
--- 1067,1075 ----
073263
   * value, init to 0 before calling.
073263
   */
073263
      int
073263
! win_lbr_chartabsize(wp, line, s, col, headp)
073263
      win_T	*wp;
073263
+     char_u	*line; /* start of the line */
073263
      char_u	*s;
073263
      colnr_T	col;
073263
      int		*headp UNUSED;
073263
***************
073263
*** 1086,1094 ****
073263
      int		n;
073263
  
073263
      /*
073263
!      * No 'linebreak' and 'showbreak': return quickly.
073263
       */
073263
!     if (!wp->w_p_lbr && *p_sbr == NUL)
073263
  #endif
073263
      {
073263
  #ifdef FEAT_MBYTE
073263
--- 1091,1099 ----
073263
      int		n;
073263
  
073263
      /*
073263
!      * No 'linebreak', 'showbreak' and 'breakindent': return quickly.
073263
       */
073263
!     if (!wp->w_p_lbr && !wp->w_p_bri && *p_sbr == NUL)
073263
  #endif
073263
      {
073263
  #ifdef FEAT_MBYTE
073263
***************
073263
*** 1163,1173 ****
073263
  # endif
073263
  
073263
      /*
073263
!      * May have to add something for 'showbreak' string at start of line
073263
       * Set *headp to the size of what we add.
073263
       */
073263
      added = 0;
073263
!     if (*p_sbr != NUL && wp->w_p_wrap && col != 0)
073263
      {
073263
  	numberextra = win_col_off(wp);
073263
  	col += numberextra + mb_added;
073263
--- 1168,1179 ----
073263
  # endif
073263
  
073263
      /*
073263
!      * May have to add something for 'breakindent' and/or 'showbreak'
073263
!      * string at start of line.
073263
       * Set *headp to the size of what we add.
073263
       */
073263
      added = 0;
073263
!     if ((*p_sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && col != 0)
073263
      {
073263
  	numberextra = win_col_off(wp);
073263
  	col += numberextra + mb_added;
073263
***************
073263
*** 1180,1186 ****
073263
  	}
073263
  	if (col == 0 || col + size > (colnr_T)W_WIDTH(wp))
073263
  	{
073263
! 	    added = vim_strsize(p_sbr);
073263
  	    if (tab_corr)
073263
  		size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts;
073263
  	    else
073263
--- 1186,1197 ----
073263
  	}
073263
  	if (col == 0 || col + size > (colnr_T)W_WIDTH(wp))
073263
  	{
073263
! 	    added = 0;
073263
! 	    if (*p_sbr != NUL)
073263
! 		added += vim_strsize(p_sbr);
073263
! 	    if (wp->w_p_bri)
073263
! 		added += get_breakindent_win(wp, line);
073263
! 
073263
  	    if (tab_corr)
073263
  		size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts;
073263
  	    else
073263
***************
073263
*** 1274,1286 ****
073263
      colnr_T	vcol;
073263
      char_u	*ptr;		/* points to current char */
073263
      char_u	*posptr;	/* points to char at pos->col */
073263
      int		incr;
073263
      int		head;
073263
      int		ts = wp->w_buffer->b_p_ts;
073263
      int		c;
073263
  
073263
      vcol = 0;
073263
!     ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE);
073263
      if (pos->col == MAXCOL)
073263
  	posptr = NULL;  /* continue until the NUL */
073263
      else
073263
--- 1285,1298 ----
073263
      colnr_T	vcol;
073263
      char_u	*ptr;		/* points to current char */
073263
      char_u	*posptr;	/* points to char at pos->col */
073263
+     char_u	*line;		/* start of the line */
073263
      int		incr;
073263
      int		head;
073263
      int		ts = wp->w_buffer->b_p_ts;
073263
      int		c;
073263
  
073263
      vcol = 0;
073263
!     line = ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE);
073263
      if (pos->col == MAXCOL)
073263
  	posptr = NULL;  /* continue until the NUL */
073263
      else
073263
***************
073263
*** 1288,1299 ****
073263
  
073263
      /*
073263
       * This function is used very often, do some speed optimizations.
073263
!      * When 'list', 'linebreak' and 'showbreak' are not set use a simple loop.
073263
       * Also use this when 'list' is set but tabs take their normal size.
073263
       */
073263
      if ((!wp->w_p_list || lcs_tab1 != NUL)
073263
  #ifdef FEAT_LINEBREAK
073263
! 	    && !wp->w_p_lbr && *p_sbr == NUL
073263
  #endif
073263
         )
073263
      {
073263
--- 1300,1312 ----
073263
  
073263
      /*
073263
       * This function is used very often, do some speed optimizations.
073263
!      * When 'list', 'linebreak', 'showbreak' and 'breakindent' are not set
073263
!      * use a simple loop.
073263
       * Also use this when 'list' is set but tabs take their normal size.
073263
       */
073263
      if ((!wp->w_p_list || lcs_tab1 != NUL)
073263
  #ifdef FEAT_LINEBREAK
073263
! 	    && !wp->w_p_lbr && *p_sbr == NUL && !wp->w_p_bri
073263
  #endif
073263
         )
073263
      {
073263
***************
073263
*** 1355,1361 ****
073263
  	{
073263
  	    /* A tab gets expanded, depending on the current column */
073263
  	    head = 0;
073263
! 	    incr = win_lbr_chartabsize(wp, ptr, vcol, &head;;
073263
  	    /* make sure we don't go past the end of the line */
073263
  	    if (*ptr == NUL)
073263
  	    {
073263
--- 1368,1374 ----
073263
  	{
073263
  	    /* A tab gets expanded, depending on the current column */
073263
  	    head = 0;
073263
! 	    incr = win_lbr_chartabsize(wp, line, ptr, vcol, &head;;
073263
  	    /* make sure we don't go past the end of the line */
073263
  	    if (*ptr == NUL)
073263
  	    {
073263
*** ../vim-7.4.337/src/edit.c	2014-05-28 21:40:47.092329130 +0200
073263
--- src/edit.c	2014-06-25 13:16:43.278160493 +0200
073263
***************
073263
*** 1956,1962 ****
073263
  	    else
073263
  #endif
073263
  		++new_cursor_col;
073263
! 	    vcol += lbr_chartabsize(ptr + new_cursor_col, (colnr_T)vcol);
073263
  	}
073263
  	vcol = last_vcol;
073263
  
073263
--- 1956,1962 ----
073263
  	    else
073263
  #endif
073263
  		++new_cursor_col;
073263
! 	    vcol += lbr_chartabsize(ptr, ptr + new_cursor_col, (colnr_T)vcol);
073263
  	}
073263
  	vcol = last_vcol;
073263
  
073263
***************
073263
*** 7126,7134 ****
073263
  	for (;;)
073263
  	{
073263
  	    coladvance(v - width);
073263
! 	    /* getviscol() is slow, skip it when 'showbreak' is empty and
073263
! 	     * there are no multi-byte characters */
073263
! 	    if ((*p_sbr == NUL
073263
  #  ifdef FEAT_MBYTE
073263
  			&& !has_mbyte
073263
  #  endif
073263
--- 7126,7135 ----
073263
  	for (;;)
073263
  	{
073263
  	    coladvance(v - width);
073263
! 	    /* getviscol() is slow, skip it when 'showbreak' is empty,
073263
! 	     * 'breakindent' is not set and there are no multi-byte
073263
! 	     * characters */
073263
! 	    if ((*p_sbr == NUL && !curwin->w_p_bri
073263
  #  ifdef FEAT_MBYTE
073263
  			&& !has_mbyte
073263
  #  endif
073263
***************
073263
*** 9758,9768 ****
073263
  	getvcol(curwin, &fpos, &vcol, NULL, NULL);
073263
  	getvcol(curwin, cursor, &want_vcol, NULL, NULL);
073263
  
073263
! 	/* Use as many TABs as possible.  Beware of 'showbreak' and
073263
! 	 * 'linebreak' adding extra virtual columns. */
073263
  	while (vim_iswhite(*ptr))
073263
  	{
073263
! 	    i = lbr_chartabsize((char_u *)"\t", vcol);
073263
  	    if (vcol + i > want_vcol)
073263
  		break;
073263
  	    if (*ptr != TAB)
073263
--- 9759,9769 ----
073263
  	getvcol(curwin, &fpos, &vcol, NULL, NULL);
073263
  	getvcol(curwin, cursor, &want_vcol, NULL, NULL);
073263
  
073263
! 	/* Use as many TABs as possible.  Beware of 'breakindent', 'showbreak'
073263
! 	 * and 'linebreak' adding extra virtual columns. */
073263
  	while (vim_iswhite(*ptr))
073263
  	{
073263
! 	    i = lbr_chartabsize(NULL, (char_u *)"\t", vcol);
073263
  	    if (vcol + i > want_vcol)
073263
  		break;
073263
  	    if (*ptr != TAB)
073263
***************
073263
*** 9784,9794 ****
073263
  	if (change_col >= 0)
073263
  	{
073263
  	    int repl_off = 0;
073263
  
073263
  	    /* Skip over the spaces we need. */
073263
  	    while (vcol < want_vcol && *ptr == ' ')
073263
  	    {
073263
! 		vcol += lbr_chartabsize(ptr, vcol);
073263
  		++ptr;
073263
  		++repl_off;
073263
  	    }
073263
--- 9785,9796 ----
073263
  	if (change_col >= 0)
073263
  	{
073263
  	    int repl_off = 0;
073263
+ 	    char_u *line = ptr;
073263
  
073263
  	    /* Skip over the spaces we need. */
073263
  	    while (vcol < want_vcol && *ptr == ' ')
073263
  	    {
073263
! 		vcol += lbr_chartabsize(line, ptr, vcol);
073263
  		++ptr;
073263
  		++repl_off;
073263
  	    }
073263
***************
073263
*** 10029,10034 ****
073263
--- 10031,10037 ----
073263
      int	    c;
073263
      int	    temp;
073263
      char_u  *ptr, *prev_ptr;
073263
+     char_u  *line;
073263
  
073263
      if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count)
073263
      {
073263
***************
073263
*** 10038,10050 ****
073263
  
073263
      /* try to advance to the cursor column */
073263
      temp = 0;
073263
!     ptr = ml_get(lnum);
073263
      prev_ptr = ptr;
073263
      validate_virtcol();
073263
      while ((colnr_T)temp < curwin->w_virtcol && *ptr != NUL)
073263
      {
073263
  	prev_ptr = ptr;
073263
! 	temp += lbr_chartabsize_adv(&ptr, (colnr_T)temp);
073263
      }
073263
      if ((colnr_T)temp > curwin->w_virtcol)
073263
  	ptr = prev_ptr;
073263
--- 10041,10053 ----
073263
  
073263
      /* try to advance to the cursor column */
073263
      temp = 0;
073263
!     line = ptr = ml_get(lnum);
073263
      prev_ptr = ptr;
073263
      validate_virtcol();
073263
      while ((colnr_T)temp < curwin->w_virtcol && *ptr != NUL)
073263
      {
073263
  	prev_ptr = ptr;
073263
! 	temp += lbr_chartabsize_adv(line, &ptr, (colnr_T)temp);
073263
      }
073263
      if ((colnr_T)temp > curwin->w_virtcol)
073263
  	ptr = prev_ptr;
073263
*** ../vim-7.4.337/src/ex_getln.c	2014-06-25 12:26:42.230046959 +0200
073263
--- src/ex_getln.c	2014-06-25 12:57:00.998115765 +0200
073263
***************
073263
*** 2302,2311 ****
073263
  
073263
  		p = (char_u *)line_ga.ga_data;
073263
  		p[line_ga.ga_len] = NUL;
073263
! 		indent = get_indent_str(p, 8);
073263
  		indent += sw - indent % sw;
073263
  add_indent:
073263
! 		while (get_indent_str(p, 8) < indent)
073263
  		{
073263
  		    char_u *s = skipwhite(p);
073263
  
073263
--- 2302,2311 ----
073263
  
073263
  		p = (char_u *)line_ga.ga_data;
073263
  		p[line_ga.ga_len] = NUL;
073263
! 		indent = get_indent_str(p, 8, FALSE);
073263
  		indent += sw - indent % sw;
073263
  add_indent:
073263
! 		while (get_indent_str(p, 8, FALSE) < indent)
073263
  		{
073263
  		    char_u *s = skipwhite(p);
073263
  
073263
***************
073263
*** 2357,2367 ****
073263
  		else
073263
  		{
073263
  		    p[line_ga.ga_len] = NUL;
073263
! 		    indent = get_indent_str(p, 8);
073263
  		    --indent;
073263
  		    indent -= indent % get_sw_value(curbuf);
073263
  		}
073263
! 		while (get_indent_str(p, 8) > indent)
073263
  		{
073263
  		    char_u *s = skipwhite(p);
073263
  
073263
--- 2357,2367 ----
073263
  		else
073263
  		{
073263
  		    p[line_ga.ga_len] = NUL;
073263
! 		    indent = get_indent_str(p, 8, FALSE);
073263
  		    --indent;
073263
  		    indent -= indent % get_sw_value(curbuf);
073263
  		}
073263
! 		while (get_indent_str(p, 8, FALSE) > indent)
073263
  		{
073263
  		    char_u *s = skipwhite(p);
073263
  
073263
*** ../vim-7.4.337/src/getchar.c	2014-05-22 18:59:54.510169240 +0200
073263
--- src/getchar.c	2014-06-25 13:16:53.946160896 +0200
073263
***************
073263
*** 2675,2681 ****
073263
  				{
073263
  				    if (!vim_iswhite(ptr[col]))
073263
  					curwin->w_wcol = vcol;
073263
! 				    vcol += lbr_chartabsize(ptr + col,
073263
  							       (colnr_T)vcol);
073263
  #ifdef FEAT_MBYTE
073263
  				    if (has_mbyte)
073263
--- 2675,2681 ----
073263
  				{
073263
  				    if (!vim_iswhite(ptr[col]))
073263
  					curwin->w_wcol = vcol;
073263
! 				    vcol += lbr_chartabsize(ptr, ptr + col,
073263
  							       (colnr_T)vcol);
073263
  #ifdef FEAT_MBYTE
073263
  				    if (has_mbyte)
073263
*** ../vim-7.4.337/src/misc1.c	2014-05-22 14:00:12.698534712 +0200
073263
--- src/misc1.c	2014-06-25 13:39:43.598212712 +0200
073263
***************
073263
*** 32,38 ****
073263
      int
073263
  get_indent()
073263
  {
073263
!     return get_indent_str(ml_get_curline(), (int)curbuf->b_p_ts);
073263
  }
073263
  
073263
  /*
073263
--- 32,38 ----
073263
      int
073263
  get_indent()
073263
  {
073263
!     return get_indent_str(ml_get_curline(), (int)curbuf->b_p_ts, FALSE);
073263
  }
073263
  
073263
  /*
073263
***************
073263
*** 42,48 ****
073263
  get_indent_lnum(lnum)
073263
      linenr_T	lnum;
073263
  {
073263
!     return get_indent_str(ml_get(lnum), (int)curbuf->b_p_ts);
073263
  }
073263
  
073263
  #if defined(FEAT_FOLDING) || defined(PROTO)
073263
--- 42,48 ----
073263
  get_indent_lnum(lnum)
073263
      linenr_T	lnum;
073263
  {
073263
!     return get_indent_str(ml_get(lnum), (int)curbuf->b_p_ts, FALSE);
073263
  }
073263
  
073263
  #if defined(FEAT_FOLDING) || defined(PROTO)
073263
***************
073263
*** 55,61 ****
073263
      buf_T	*buf;
073263
      linenr_T	lnum;
073263
  {
073263
!     return get_indent_str(ml_get_buf(buf, lnum, FALSE), (int)buf->b_p_ts);
073263
  }
073263
  #endif
073263
  
073263
--- 55,61 ----
073263
      buf_T	*buf;
073263
      linenr_T	lnum;
073263
  {
073263
!     return get_indent_str(ml_get_buf(buf, lnum, FALSE), (int)buf->b_p_ts, FALSE);
073263
  }
073263
  #endif
073263
  
073263
***************
073263
*** 64,79 ****
073263
   * 'tabstop' at "ts"
073263
   */
073263
      int
073263
! get_indent_str(ptr, ts)
073263
      char_u	*ptr;
073263
      int		ts;
073263
  {
073263
      int		count = 0;
073263
  
073263
      for ( ; *ptr; ++ptr)
073263
      {
073263
! 	if (*ptr == TAB)    /* count a tab for what it is worth */
073263
! 	    count += ts - (count % ts);
073263
  	else if (*ptr == ' ')
073263
  	    ++count;		/* count a space for one */
073263
  	else
073263
--- 64,86 ----
073263
   * 'tabstop' at "ts"
073263
   */
073263
      int
073263
! get_indent_str(ptr, ts, list)
073263
      char_u	*ptr;
073263
      int		ts;
073263
+     int		list; /* if TRUE, count only screen size for tabs */
073263
  {
073263
      int		count = 0;
073263
  
073263
      for ( ; *ptr; ++ptr)
073263
      {
073263
! 	if (*ptr == TAB)
073263
! 	{
073263
! 	    if (!list || lcs_tab1)    /* count a tab for what it is worth */
073263
! 		count += ts - (count % ts);
073263
! 	    else
073263
! 	/* in list mode, when tab is not set, count screen char width for Tab: ^I */
073263
! 		count += ptr2cells(ptr);
073263
! 	}
073263
  	else if (*ptr == ' ')
073263
  	    ++count;		/* count a space for one */
073263
  	else
073263
***************
073263
*** 476,481 ****
073263
--- 483,540 ----
073263
      return (int)col;
073263
  }
073263
  
073263
+ #if defined(FEAT_LINEBREAK) || defined(PROTO)
073263
+ /*
073263
+  * Return appropriate space number for breakindent, taking influencing
073263
+  * parameters into account. Window must be specified, since it is not
073263
+  * necessarily always the current one.
073263
+  */
073263
+     int
073263
+ get_breakindent_win(wp, line)
073263
+     win_T	*wp;
073263
+     char_u	*line; /* start of the line */
073263
+ {
073263
+     static int	    prev_indent = 0;  /* cached indent value */
073263
+     static long	    prev_ts     = 0L; /* cached tabstop value */
073263
+     static char_u   *prev_line = NULL; /* cached pointer to line */
073263
+     int		    bri = 0;
073263
+     /* window width minus window margin space, i.e. what rests for text */
073263
+     const int	    eff_wwidth = W_WIDTH(wp)
073263
+ 			    - ((wp->w_p_nu || wp->w_p_rnu)
073263
+ 				&& (vim_strchr(p_cpo, CPO_NUMCOL) == NULL)
073263
+ 						? number_width(wp) + 1 : 0);
073263
+ 
073263
+     /* used cached indent, unless pointer or 'tabstop' changed */
073263
+     if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts)
073263
+     {
073263
+ 	prev_line = line;
073263
+ 	prev_ts = wp->w_buffer->b_p_ts;
073263
+ 	prev_indent = get_indent_str(line,
073263
+ 		  (int)wp->w_buffer->b_p_ts, wp->w_p_list) + wp->w_p_brishift;
073263
+     }
073263
+ 
073263
+     /* indent minus the length of the showbreak string */
073263
+     bri = prev_indent;
073263
+     if (wp->w_p_brisbr)
073263
+ 	bri -= vim_strsize(p_sbr);
073263
+ 
073263
+     /* Add offset for number column, if 'n' is in 'cpoptions' */
073263
+     bri += win_col_off2(wp);
073263
+ 
073263
+     /* never indent past left window margin */
073263
+     if (bri < 0)
073263
+ 	bri = 0;
073263
+     /* always leave at least bri_min characters on the left,
073263
+      * if text width is sufficient */
073263
+     else if (bri > eff_wwidth - wp->w_p_brimin)
073263
+ 	bri = (eff_wwidth - wp->w_p_brimin < 0)
073263
+ 			    ? 0 : eff_wwidth - wp->w_p_brimin;
073263
+ 
073263
+     return bri;
073263
+ }
073263
+ #endif
073263
+ 
073263
+ 
073263
  #if defined(FEAT_CINDENT) || defined(FEAT_SMARTINDENT)
073263
  
073263
  static int cin_is_cinword __ARGS((char_u *line));
073263
***************
073263
*** 678,684 ****
073263
  	/*
073263
  	 * count white space on current line
073263
  	 */
073263
! 	newindent = get_indent_str(saved_line, (int)curbuf->b_p_ts);
073263
  	if (newindent == 0 && !(flags & OPENLINE_COM_LIST))
073263
  	    newindent = second_line_indent; /* for ^^D command in insert mode */
073263
  
073263
--- 737,743 ----
073263
  	/*
073263
  	 * count white space on current line
073263
  	 */
073263
! 	newindent = get_indent_str(saved_line, (int)curbuf->b_p_ts, FALSE);
073263
  	if (newindent == 0 && !(flags & OPENLINE_COM_LIST))
073263
  	    newindent = second_line_indent; /* for ^^D command in insert mode */
073263
  
073263
***************
073263
*** 1201,1207 ****
073263
  					|| do_si
073263
  #endif
073263
  							   )
073263
! 			newindent = get_indent_str(leader, (int)curbuf->b_p_ts);
073263
  
073263
  		    /* Add the indent offset */
073263
  		    if (newindent + off < 0)
073263
--- 1260,1266 ----
073263
  					|| do_si
073263
  #endif
073263
  							   )
073263
! 			newindent = get_indent_str(leader, (int)curbuf->b_p_ts, FALSE);
073263
  
073263
  		    /* Add the indent offset */
073263
  		    if (newindent + off < 0)
073263
***************
073263
*** 1994,1999 ****
073263
--- 2053,2059 ----
073263
      char_u	*s;
073263
      int		lines = 0;
073263
      int		width;
073263
+     char_u	*line;
073263
  
073263
  #ifdef FEAT_DIFF
073263
      /* Check for filler lines above this buffer line.  When folded the result
073263
***************
073263
*** 2009,2020 ****
073263
  	return lines + 1;
073263
  #endif
073263
  
073263
!     s = ml_get_buf(wp->w_buffer, lnum, FALSE);
073263
  
073263
      col = 0;
073263
      while (*s != NUL && --column >= 0)
073263
      {
073263
! 	col += win_lbr_chartabsize(wp, s, (colnr_T)col, NULL);
073263
  	mb_ptr_adv(s);
073263
      }
073263
  
073263
--- 2069,2080 ----
073263
  	return lines + 1;
073263
  #endif
073263
  
073263
!     line = s = ml_get_buf(wp->w_buffer, lnum, FALSE);
073263
  
073263
      col = 0;
073263
      while (*s != NUL && --column >= 0)
073263
      {
073263
! 	col += win_lbr_chartabsize(wp, line, s, (colnr_T)col, NULL);
073263
  	mb_ptr_adv(s);
073263
      }
073263
  
073263
***************
073263
*** 2026,2032 ****
073263
       * 'ts') -- webb.
073263
       */
073263
      if (*s == TAB && (State & NORMAL) && (!wp->w_p_list || lcs_tab1))
073263
! 	col += win_lbr_chartabsize(wp, s, (colnr_T)col, NULL) - 1;
073263
  
073263
      /*
073263
       * Add column offset for 'number', 'relativenumber', 'foldcolumn', etc.
073263
--- 2086,2092 ----
073263
       * 'ts') -- webb.
073263
       */
073263
      if (*s == TAB && (State & NORMAL) && (!wp->w_p_list || lcs_tab1))
073263
! 	col += win_lbr_chartabsize(wp, line, s, (colnr_T)col, NULL) - 1;
073263
  
073263
      /*
073263
       * Add column offset for 'number', 'relativenumber', 'foldcolumn', etc.
073263
***************
073263
*** 9002,9011 ****
073263
  		amount = 2;
073263
  	    else
073263
  	    {
073263
  		amount = 0;
073263
  		while (*that && col)
073263
  		{
073263
! 		    amount += lbr_chartabsize_adv(&that, (colnr_T)amount);
073263
  		    col--;
073263
  		}
073263
  
073263
--- 9062,9073 ----
073263
  		amount = 2;
073263
  	    else
073263
  	    {
073263
+ 		char_u *line = that;
073263
+ 
073263
  		amount = 0;
073263
  		while (*that && col)
073263
  		{
073263
! 		    amount += lbr_chartabsize_adv(line, &that, (colnr_T)amount);
073263
  		    col--;
073263
  		}
073263
  
073263
***************
073263
*** 9028,9034 ****
073263
  
073263
  		    while (vim_iswhite(*that))
073263
  		    {
073263
! 			amount += lbr_chartabsize(that, (colnr_T)amount);
073263
  			++that;
073263
  		    }
073263
  
073263
--- 9090,9096 ----
073263
  
073263
  		    while (vim_iswhite(*that))
073263
  		    {
073263
! 			amount += lbr_chartabsize(line, that, (colnr_T)amount);
073263
  			++that;
073263
  		    }
073263
  
073263
***************
073263
*** 9066,9080 ****
073263
  							       && !quotecount)
073263
  				    --parencount;
073263
  				if (*that == '\\' && *(that+1) != NUL)
073263
! 				    amount += lbr_chartabsize_adv(&that,
073263
! 							     (colnr_T)amount);
073263
! 				amount += lbr_chartabsize_adv(&that,
073263
! 							     (colnr_T)amount);
073263
  			    }
073263
  			}
073263
  			while (vim_iswhite(*that))
073263
  			{
073263
! 			    amount += lbr_chartabsize(that, (colnr_T)amount);
073263
  			    that++;
073263
  			}
073263
  			if (!*that || *that == ';')
073263
--- 9128,9143 ----
073263
  							       && !quotecount)
073263
  				    --parencount;
073263
  				if (*that == '\\' && *(that+1) != NUL)
073263
! 				    amount += lbr_chartabsize_adv(
073263
! 						line, &that, (colnr_T)amount);
073263
! 				amount += lbr_chartabsize_adv(
073263
! 						line, &that, (colnr_T)amount);
073263
  			    }
073263
  			}
073263
  			while (vim_iswhite(*that))
073263
  			{
073263
! 			    amount += lbr_chartabsize(
073263
! 						 line, that, (colnr_T)amount);
073263
  			    that++;
073263
  			}
073263
  			if (!*that || *that == ';')
073263
*** ../vim-7.4.337/src/misc2.c	2014-05-07 18:35:25.669216052 +0200
073263
--- src/misc2.c	2014-06-25 13:21:18.474170904 +0200
073263
***************
073263
*** 201,210 ****
073263
  	{
073263
  	    /* Count a tab for what it's worth (if list mode not on) */
073263
  #ifdef FEAT_LINEBREAK
073263
! 	    csize = win_lbr_chartabsize(curwin, ptr, col, &head;;
073263
  	    mb_ptr_adv(ptr);
073263
  #else
073263
! 	    csize = lbr_chartabsize_adv(&ptr, col);
073263
  #endif
073263
  	    col += csize;
073263
  	}
073263
--- 201,210 ----
073263
  	{
073263
  	    /* Count a tab for what it's worth (if list mode not on) */
073263
  #ifdef FEAT_LINEBREAK
073263
! 	    csize = win_lbr_chartabsize(curwin, line, ptr, col, &head;;
073263
  	    mb_ptr_adv(ptr);
073263
  #else
073263
! 	    csize = lbr_chartabsize_adv(line, &ptr, col);
073263
  #endif
073263
  	    col += csize;
073263
  	}
073263
***************
073263
*** 2156,2162 ****
073263
      }
073263
  }
073263
  
073263
! #if (defined(UNIX) && !defined(USE_SYSTEM)) || defined(WIN3264)
073263
  /*
073263
   * Append the text in "gap" below the cursor line and clear "gap".
073263
   */
073263
--- 2156,2163 ----
073263
      }
073263
  }
073263
  
073263
! #if (defined(UNIX) && !defined(USE_SYSTEM)) || defined(WIN3264) \
073263
! 	|| defined(PROTO)
073263
  /*
073263
   * Append the text in "gap" below the cursor line and clear "gap".
073263
   */
073263
*** ../vim-7.4.337/src/ops.c	2014-06-17 18:16:08.420691059 +0200
073263
--- src/ops.c	2014-06-25 13:18:27.082164420 +0200
073263
***************
073263
*** 420,426 ****
073263
  	}
073263
  	for ( ; vim_iswhite(*bd.textstart); )
073263
  	{
073263
! 	    incr = lbr_chartabsize_adv(&bd.textstart, (colnr_T)(bd.start_vcol));
073263
  	    total += incr;
073263
  	    bd.start_vcol += incr;
073263
  	}
073263
--- 420,428 ----
073263
  	}
073263
  	for ( ; vim_iswhite(*bd.textstart); )
073263
  	{
073263
! 	    /* TODO: is passing bd.textstart for start of the line OK? */
073263
! 	    incr = lbr_chartabsize_adv(bd.textstart, &bd.textstart,
073263
! 						    (colnr_T)(bd.start_vcol));
073263
  	    total += incr;
073263
  	    bd.start_vcol += incr;
073263
  	}
073263
***************
073263
*** 480,486 ****
073263
  
073263
  	while (vim_iswhite(*non_white))
073263
  	{
073263
! 	    incr = lbr_chartabsize_adv(&non_white, non_white_col);
073263
  	    non_white_col += incr;
073263
  	}
073263
  
073263
--- 482,488 ----
073263
  
073263
  	while (vim_iswhite(*non_white))
073263
  	{
073263
! 	    incr = lbr_chartabsize_adv(bd.textstart, &non_white, non_white_col);
073263
  	    non_white_col += incr;
073263
  	}
073263
  
073263
***************
073263
*** 505,511 ****
073263
  	    verbatim_copy_width -= bd.start_char_vcols;
073263
  	while (verbatim_copy_width < destination_col)
073263
  	{
073263
! 	    incr = lbr_chartabsize(verbatim_copy_end, verbatim_copy_width);
073263
  	    if (verbatim_copy_width + incr > destination_col)
073263
  		break;
073263
  	    verbatim_copy_width += incr;
073263
--- 507,517 ----
073263
  	    verbatim_copy_width -= bd.start_char_vcols;
073263
  	while (verbatim_copy_width < destination_col)
073263
  	{
073263
! 	    char_u *line = verbatim_copy_end;
073263
! 
073263
! 	    /* TODO: is passing verbatim_copy_end for start of the line OK? */
073263
! 	    incr = lbr_chartabsize(line, verbatim_copy_end,
073263
! 							 verbatim_copy_width);
073263
  	    if (verbatim_copy_width + incr > destination_col)
073263
  		break;
073263
  	    verbatim_copy_width += incr;
073263
***************
073263
*** 3617,3623 ****
073263
  	    for (ptr = oldp; vcol < col && *ptr; )
073263
  	    {
073263
  		/* Count a tab for what it's worth (if list mode not on) */
073263
! 		incr = lbr_chartabsize_adv(&ptr, (colnr_T)vcol);
073263
  		vcol += incr;
073263
  	    }
073263
  	    bd.textcol = (colnr_T)(ptr - oldp);
073263
--- 3623,3629 ----
073263
  	    for (ptr = oldp; vcol < col && *ptr; )
073263
  	    {
073263
  		/* Count a tab for what it's worth (if list mode not on) */
073263
! 		incr = lbr_chartabsize_adv(oldp, &ptr, (colnr_T)vcol);
073263
  		vcol += incr;
073263
  	    }
073263
  	    bd.textcol = (colnr_T)(ptr - oldp);
073263
***************
073263
*** 3651,3657 ****
073263
  	    /* calculate number of spaces required to fill right side of block*/
073263
  	    spaces = y_width + 1;
073263
  	    for (j = 0; j < yanklen; j++)
073263
! 		spaces -= lbr_chartabsize(&y_array[i][j], 0);
073263
  	    if (spaces < 0)
073263
  		spaces = 0;
073263
  
073263
--- 3657,3663 ----
073263
  	    /* calculate number of spaces required to fill right side of block*/
073263
  	    spaces = y_width + 1;
073263
  	    for (j = 0; j < yanklen; j++)
073263
! 		spaces -= lbr_chartabsize(NULL, &y_array[i][j], 0);
073263
  	    if (spaces < 0)
073263
  		spaces = 0;
073263
  
073263
***************
073263
*** 5203,5209 ****
073263
      while (bdp->start_vcol < oap->start_vcol && *pstart)
073263
      {
073263
  	/* Count a tab for what it's worth (if list mode not on) */
073263
! 	incr = lbr_chartabsize(pstart, (colnr_T)bdp->start_vcol);
073263
  	bdp->start_vcol += incr;
073263
  #ifdef FEAT_VISUALEXTRA
073263
  	if (vim_iswhite(*pstart))
073263
--- 5209,5215 ----
073263
      while (bdp->start_vcol < oap->start_vcol && *pstart)
073263
      {
073263
  	/* Count a tab for what it's worth (if list mode not on) */
073263
! 	incr = lbr_chartabsize(line, pstart, (colnr_T)bdp->start_vcol);
073263
  	bdp->start_vcol += incr;
073263
  #ifdef FEAT_VISUALEXTRA
073263
  	if (vim_iswhite(*pstart))
073263
***************
073263
*** 5272,5278 ****
073263
  	    {
073263
  		/* Count a tab for what it's worth (if list mode not on) */
073263
  		prev_pend = pend;
073263
! 		incr = lbr_chartabsize_adv(&pend, (colnr_T)bdp->end_vcol);
073263
  		bdp->end_vcol += incr;
073263
  	    }
073263
  	    if (bdp->end_vcol <= oap->end_vcol
073263
--- 5278,5287 ----
073263
  	    {
073263
  		/* Count a tab for what it's worth (if list mode not on) */
073263
  		prev_pend = pend;
073263
! 		/* TODO: is passing prev_pend for start of the line OK?
073263
! 		 * perhaps it should be "line". */
073263
! 		incr = lbr_chartabsize_adv(prev_pend, &pend,
073263
! 						      (colnr_T)bdp->end_vcol);
073263
  		bdp->end_vcol += incr;
073263
  	    }
073263
  	    if (bdp->end_vcol <= oap->end_vcol
073263
***************
073263
*** 6882,6888 ****
073263
  	    validate_virtcol();
073263
  	    col_print(buf1, sizeof(buf1), (int)curwin->w_cursor.col + 1,
073263
  		    (int)curwin->w_virtcol + 1);
073263
! 	    col_print(buf2, sizeof(buf2), (int)STRLEN(p), linetabsize(p));
073263
  
073263
  	    if (char_count_cursor == byte_count_cursor
073263
  		    && char_count == byte_count)
073263
--- 6891,6898 ----
073263
  	    validate_virtcol();
073263
  	    col_print(buf1, sizeof(buf1), (int)curwin->w_cursor.col + 1,
073263
  		    (int)curwin->w_virtcol + 1);
073263
! 	    col_print(buf2, sizeof(buf2), (int)STRLEN(p),
073263
! 				linetabsize(p));
073263
  
073263
  	    if (char_count_cursor == byte_count_cursor
073263
  		    && char_count == byte_count)
073263
*** ../vim-7.4.337/src/option.c	2014-06-25 11:48:40.733960646 +0200
073263
--- src/option.c	2014-06-25 14:31:41.630330672 +0200
073263
***************
073263
*** 188,193 ****
073263
--- 188,197 ----
073263
  #ifdef FEAT_ARABIC
073263
  # define PV_ARAB	OPT_WIN(WV_ARAB)
073263
  #endif
073263
+ #ifdef FEAT_LINEBREAK
073263
+ # define PV_BRI		OPT_WIN(WV_BRI)
073263
+ # define PV_BRIOPT	OPT_WIN(WV_BRIOPT)
073263
+ #endif
073263
  #ifdef FEAT_DIFF
073263
  # define PV_DIFF	OPT_WIN(WV_DIFF)
073263
  #endif
073263
***************
073263
*** 648,653 ****
073263
--- 652,675 ----
073263
  			    {(char_u *)0L, (char_u *)0L}
073263
  #endif
073263
  			    SCRIPTID_INIT},
073263
+     {"breakindent",   "bri",  P_BOOL|P_VI_DEF|P_VIM|P_RWIN,
073263
+ #ifdef FEAT_LINEBREAK
073263
+ 			    (char_u *)VAR_WIN, PV_BRI,
073263
+ 			    {(char_u *)FALSE, (char_u *)0L}
073263
+ #else
073263
+ 			    (char_u *)NULL, PV_NONE,
073263
+ 			    {(char_u *)0L, (char_u *)0L}
073263
+ #endif
073263
+ 			    SCRIPTID_INIT},
073263
+     {"breakindentopt", "briopt", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_COMMA|P_NODUP,
073263
+ #ifdef FEAT_LINEBREAK
073263
+ 			    (char_u *)VAR_WIN, PV_BRIOPT,
073263
+ 			    {(char_u *)"", (char_u *)NULL}
073263
+ #else
073263
+ 			    (char_u *)NULL, PV_NONE,
073263
+ 			    {(char_u *)"", (char_u *)NULL}
073263
+ #endif
073263
+ 			    SCRIPTID_INIT},
073263
      {"browsedir",   "bsdir",P_STRING|P_VI_DEF,
073263
  #ifdef FEAT_BROWSE
073263
  			    (char_u *)&p_bsdir, PV_NONE,
073263
***************
073263
*** 5256,5261 ****
073263
--- 5278,5286 ----
073263
      /* set cedit_key */
073263
      (void)check_cedit();
073263
  #endif
073263
+ #ifdef FEAT_LINEBREAK
073263
+     briopt_check();
073263
+ #endif
073263
  }
073263
  
073263
  /*
073263
***************
073263
*** 5709,5714 ****
073263
--- 5734,5747 ----
073263
  		     *p_pm == '.' ? p_pm + 1 : p_pm) == 0)
073263
  	    errmsg = (char_u *)N_("E589: 'backupext' and 'patchmode' are equal");
073263
      }
073263
+ #ifdef FEAT_LINEBREAK
073263
+     /* 'breakindentopt' */
073263
+     else if (varp == &curwin->w_p_briopt)
073263
+     {
073263
+ 	if (briopt_check() == FAIL)
073263
+ 	    errmsg = e_invarg;
073263
+     }
073263
+ #endif
073263
  
073263
      /*
073263
       * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[]
073263
***************
073263
*** 10018,10023 ****
073263
--- 10051,10058 ----
073263
  	case PV_WRAP:	return (char_u *)&(curwin->w_p_wrap);
073263
  #ifdef FEAT_LINEBREAK
073263
  	case PV_LBR:	return (char_u *)&(curwin->w_p_lbr);
073263
+ 	case PV_BRI:	return (char_u *)&(curwin->w_p_bri);
073263
+ 	case PV_BRIOPT: return (char_u *)&(curwin->w_p_briopt);
073263
  #endif
073263
  #ifdef FEAT_SCROLLBIND
073263
  	case PV_SCBIND: return (char_u *)&(curwin->w_p_scb);
073263
***************
073263
*** 10207,10212 ****
073263
--- 10242,10249 ----
073263
  #endif
073263
  #ifdef FEAT_LINEBREAK
073263
      to->wo_lbr = from->wo_lbr;
073263
+     to->wo_bri = from->wo_bri;
073263
+     to->wo_briopt = vim_strsave(from->wo_briopt);
073263
  #endif
073263
  #ifdef FEAT_SCROLLBIND
073263
      to->wo_scb = from->wo_scb;
073263
***************
073263
*** 10294,10299 ****
073263
--- 10331,10339 ----
073263
  #ifdef FEAT_CONCEAL
073263
      check_string_option(&wop->wo_cocu);
073263
  #endif
073263
+ #ifdef FEAT_LINEBREAK
073263
+     check_string_option(&wop->wo_briopt);
073263
+ #endif
073263
  }
073263
  
073263
  /*
073263
***************
073263
*** 10313,10318 ****
073263
--- 10353,10361 ----
073263
  # endif
073263
      clear_string_option(&wop->wo_fmr);
073263
  #endif
073263
+ #ifdef FEAT_LINEBREAK
073263
+     clear_string_option(&wop->wo_briopt);
073263
+ #endif
073263
  #ifdef FEAT_RIGHTLEFT
073263
      clear_string_option(&wop->wo_rlc);
073263
  #endif
073263
***************
073263
*** 11927,11929 ****
073263
--- 11970,12018 ----
073263
  	    ++ptr;
073263
      }
073263
  }
073263
+ 
073263
+ #if defined(FEAT_LINEBREAK) || defined(PROTO)
073263
+ /*
073263
+  * This is called when 'breakindentopt' is changed and when a window is
073263
+  * initialized.
073263
+  */
073263
+     int
073263
+ briopt_check()
073263
+ {
073263
+     char_u	*p;
073263
+     int		bri_shift = 0;
073263
+     long	bri_min = 20;
073263
+     int		bri_sbr = FALSE;
073263
+ 
073263
+     p = curwin->w_p_briopt;
073263
+     while (*p != NUL)
073263
+     {
073263
+ 	if (STRNCMP(p, "shift:", 6) == 0
073263
+ 		 && ((p[6] == '-' && VIM_ISDIGIT(p[7])) || VIM_ISDIGIT(p[6])))
073263
+ 	{
073263
+ 	    p += 6;
073263
+ 	    bri_shift = getdigits(&p);
073263
+ 	}
073263
+ 	else if (STRNCMP(p, "min:", 4) == 0 && VIM_ISDIGIT(p[4]))
073263
+ 	{
073263
+ 	    p += 4;
073263
+ 	    bri_min = getdigits(&p);
073263
+ 	}
073263
+ 	else if (STRNCMP(p, "sbr", 3) == 0)
073263
+ 	{
073263
+ 	    p += 3;
073263
+ 	    bri_sbr = TRUE;
073263
+ 	}
073263
+ 	if (*p != ',' && *p != NUL)
073263
+ 	    return FAIL;
073263
+ 	if (*p == ',')
073263
+ 	    ++p;
073263
+     }
073263
+ 
073263
+     curwin->w_p_brishift = bri_shift;
073263
+     curwin->w_p_brimin   = bri_min;
073263
+     curwin->w_p_brisbr   = bri_sbr;
073263
+ 
073263
+     return OK;
073263
+ }
073263
+ #endif
073263
*** ../vim-7.4.337/src/option.h	2014-05-28 21:40:47.092329130 +0200
073263
--- src/option.h	2014-06-25 12:57:01.002115765 +0200
073263
***************
073263
*** 1052,1057 ****
073263
--- 1052,1061 ----
073263
  #ifdef FEAT_CURSORBIND
073263
      , WV_CRBIND
073263
  #endif
073263
+ #ifdef FEAT_LINEBREAK
073263
+     , WV_BRI
073263
+     , WV_BRIOPT
073263
+ #endif
073263
  #ifdef FEAT_DIFF
073263
      , WV_DIFF
073263
  #endif
073263
*** ../vim-7.4.337/src/proto/charset.pro	2013-08-10 13:37:07.000000000 +0200
073263
--- src/proto/charset.pro	2014-06-25 13:22:32.934173721 +0200
073263
***************
073263
*** 16,22 ****
073263
  int chartabsize __ARGS((char_u *p, colnr_T col));
073263
  int linetabsize __ARGS((char_u *s));
073263
  int linetabsize_col __ARGS((int startcol, char_u *s));
073263
! int win_linetabsize __ARGS((win_T *wp, char_u *p, colnr_T len));
073263
  int vim_isIDc __ARGS((int c));
073263
  int vim_iswordc __ARGS((int c));
073263
  int vim_iswordc_buf __ARGS((int c, buf_T *buf));
073263
--- 16,22 ----
073263
  int chartabsize __ARGS((char_u *p, colnr_T col));
073263
  int linetabsize __ARGS((char_u *s));
073263
  int linetabsize_col __ARGS((int startcol, char_u *s));
073263
! int win_linetabsize __ARGS((win_T *wp, char_u *line, colnr_T len));
073263
  int vim_isIDc __ARGS((int c));
073263
  int vim_iswordc __ARGS((int c));
073263
  int vim_iswordc_buf __ARGS((int c, buf_T *buf));
073263
***************
073263
*** 26,34 ****
073263
  int vim_isfilec_or_wc __ARGS((int c));
073263
  int vim_isprintc __ARGS((int c));
073263
  int vim_isprintc_strict __ARGS((int c));
073263
! int lbr_chartabsize __ARGS((unsigned char *s, colnr_T col));
073263
! int lbr_chartabsize_adv __ARGS((char_u **s, colnr_T col));
073263
! int win_lbr_chartabsize __ARGS((win_T *wp, char_u *s, colnr_T col, int *headp));
073263
  int in_win_border __ARGS((win_T *wp, colnr_T vcol));
073263
  void getvcol __ARGS((win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end));
073263
  colnr_T getvcol_nolist __ARGS((pos_T *posp));
073263
--- 26,34 ----
073263
  int vim_isfilec_or_wc __ARGS((int c));
073263
  int vim_isprintc __ARGS((int c));
073263
  int vim_isprintc_strict __ARGS((int c));
073263
! int lbr_chartabsize __ARGS((char_u *line, unsigned char *s, colnr_T col));
073263
! int lbr_chartabsize_adv __ARGS((char_u *line, char_u **s, colnr_T col));
073263
! int win_lbr_chartabsize __ARGS((win_T *wp, char_u *line, char_u *s, colnr_T col, int *headp));
073263
  int in_win_border __ARGS((win_T *wp, colnr_T vcol));
073263
  void getvcol __ARGS((win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end));
073263
  colnr_T getvcol_nolist __ARGS((pos_T *posp));
073263
*** ../vim-7.4.337/src/proto/misc1.pro	2014-05-07 15:10:17.661108310 +0200
073263
--- src/proto/misc1.pro	2014-06-25 12:57:01.002115765 +0200
073263
***************
073263
*** 2,10 ****
073263
  int get_indent __ARGS((void));
073263
  int get_indent_lnum __ARGS((linenr_T lnum));
073263
  int get_indent_buf __ARGS((buf_T *buf, linenr_T lnum));
073263
! int get_indent_str __ARGS((char_u *ptr, int ts));
073263
  int set_indent __ARGS((int size, int flags));
073263
  int get_number_indent __ARGS((linenr_T lnum));
073263
  int open_line __ARGS((int dir, int flags, int second_line_indent));
073263
  int get_leader_len __ARGS((char_u *line, char_u **flags, int backward, int include_space));
073263
  int get_last_leader_offset __ARGS((char_u *line, char_u **flags));
073263
--- 2,11 ----
073263
  int get_indent __ARGS((void));
073263
  int get_indent_lnum __ARGS((linenr_T lnum));
073263
  int get_indent_buf __ARGS((buf_T *buf, linenr_T lnum));
073263
! int get_indent_str __ARGS((char_u *ptr, int ts, int list));
073263
  int set_indent __ARGS((int size, int flags));
073263
  int get_number_indent __ARGS((linenr_T lnum));
073263
+ int get_breakindent_win __ARGS((win_T *wp, char_u *ptr));
073263
  int open_line __ARGS((int dir, int flags, int second_line_indent));
073263
  int get_leader_len __ARGS((char_u *line, char_u **flags, int backward, int include_space));
073263
  int get_last_leader_offset __ARGS((char_u *line, char_u **flags));
073263
*** ../vim-7.4.337/src/proto/option.pro	2014-01-14 16:54:53.000000000 +0100
073263
--- src/proto/option.pro	2014-06-25 14:16:04.882295233 +0200
073263
***************
073263
*** 63,66 ****
073263
--- 63,67 ----
073263
  long get_sw_value __ARGS((buf_T *buf));
073263
  long get_sts_value __ARGS((void));
073263
  void find_mps_values __ARGS((int *initc, int *findc, int *backwards, int switchit));
073263
+ int briopt_check __ARGS((void));
073263
  /* vim: set ft=c : */
073263
*** ../vim-7.4.337/src/screen.c	2014-06-18 21:20:07.232377308 +0200
073263
--- src/screen.c	2014-06-25 13:43:39.930221653 +0200
073263
***************
073263
*** 2962,2971 ****
073263
  # define WL_SIGN	WL_FOLD		/* column for signs */
073263
  #endif
073263
  #define WL_NR		WL_SIGN + 1	/* line number */
073263
  #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
073263
! # define WL_SBR		WL_NR + 1	/* 'showbreak' or 'diff' */
073263
  #else
073263
! # define WL_SBR		WL_NR
073263
  #endif
073263
  #define WL_LINE		WL_SBR + 1	/* text in the line */
073263
      int		draw_state = WL_START;	/* what to draw next */
073263
--- 2962,2976 ----
073263
  # define WL_SIGN	WL_FOLD		/* column for signs */
073263
  #endif
073263
  #define WL_NR		WL_SIGN + 1	/* line number */
073263
+ #ifdef FEAT_LINEBREAK
073263
+ # define WL_BRI		WL_NR + 1	/* 'breakindent' */
073263
+ #else
073263
+ # define WL_BRI		WL_NR
073263
+ #endif
073263
  #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
073263
! # define WL_SBR		WL_BRI + 1	/* 'showbreak' or 'diff' */
073263
  #else
073263
! # define WL_SBR		WL_BRI
073263
  #endif
073263
  #define WL_LINE		WL_SBR + 1	/* text in the line */
073263
      int		draw_state = WL_START;	/* what to draw next */
073263
***************
073263
*** 3301,3307 ****
073263
  #endif
073263
  	while (vcol < v && *ptr != NUL)
073263
  	{
073263
! 	    c = win_lbr_chartabsize(wp, ptr, (colnr_T)vcol, NULL);
073263
  	    vcol += c;
073263
  #ifdef FEAT_MBYTE
073263
  	    prev_ptr = ptr;
073263
--- 3306,3312 ----
073263
  #endif
073263
  	while (vcol < v && *ptr != NUL)
073263
  	{
073263
! 	    c = win_lbr_chartabsize(wp, line, ptr, (colnr_T)vcol, NULL);
073263
  	    vcol += c;
073263
  #ifdef FEAT_MBYTE
073263
  	    prev_ptr = ptr;
073263
***************
073263
*** 3670,3675 ****
073263
--- 3675,3718 ----
073263
  		}
073263
  	    }
073263
  
073263
+ #ifdef FEAT_LINEBREAK
073263
+ 	    if (wp->w_p_brisbr && draw_state == WL_BRI - 1
073263
+ 					     && n_extra == 0 && *p_sbr != NUL)
073263
+ 		/* draw indent after showbreak value */
073263
+ 		draw_state = WL_BRI;
073263
+ 	    else if (wp->w_p_brisbr && draw_state == WL_SBR && n_extra == 0)
073263
+ 		/* After the showbreak, draw the breakindent */
073263
+ 		draw_state = WL_BRI - 1;
073263
+ 
073263
+ 	    /* draw 'breakindent': indent wrapped text accordingly */
073263
+ 	    if (draw_state == WL_BRI - 1 && n_extra == 0)
073263
+ 	    {
073263
+ 		draw_state = WL_BRI;
073263
+ # ifdef FEAT_DIFF
073263
+ # endif
073263
+ 		if (wp->w_p_bri && n_extra == 0 && row != startrow
073263
+ #ifdef FEAT_DIFF
073263
+ 			&& filler_lines == 0
073263
+ #endif
073263
+ 		   )
073263
+ 		{
073263
+ 		    char_attr = 0; /* was: hl_attr(HLF_AT); */
073263
+ #ifdef FEAT_DIFF
073263
+ 		    if (diff_hlf != (hlf_T)0)
073263
+ 			char_attr = hl_attr(diff_hlf);
073263
+ #endif
073263
+ 		    p_extra = NUL;
073263
+ 		    c_extra = ' ';
073263
+ 		    n_extra = get_breakindent_win(wp,
073263
+ 				       ml_get_buf(wp->w_buffer, lnum, FALSE));
073263
+ 		    /* Correct end of highlighted area for 'breakindent',
073263
+ 		     * required when 'linebreak' is also set. */
073263
+ 		    if (tocol == vcol)
073263
+ 			tocol += n_extra;
073263
+ 		}
073263
+ 	    }
073263
+ #endif
073263
+ 
073263
  #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
073263
  	    if (draw_state == WL_SBR - 1 && n_extra == 0)
073263
  	    {
073263
***************
073263
*** 4382,4392 ****
073263
  		if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)
073263
  							     && !wp->w_p_list)
073263
  		{
073263
! 		    n_extra = win_lbr_chartabsize(wp, ptr - (
073263
  # ifdef FEAT_MBYTE
073263
  				has_mbyte ? mb_l :
073263
  # endif
073263
! 				1), (colnr_T)vcol, NULL) - 1;
073263
  		    c_extra = ' ';
073263
  		    if (vim_iswhite(c))
073263
  		    {
073263
--- 4425,4438 ----
073263
  		if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)
073263
  							     && !wp->w_p_list)
073263
  		{
073263
! 		    char_u *p = ptr - (
073263
  # ifdef FEAT_MBYTE
073263
  				has_mbyte ? mb_l :
073263
  # endif
073263
! 				1);
073263
! 		    /* TODO: is passing p for start of the line OK? */
073263
! 		    n_extra = win_lbr_chartabsize(wp, p, p, (colnr_T)vcol,
073263
! 								    NULL) - 1;
073263
  		    c_extra = ' ';
073263
  		    if (vim_iswhite(c))
073263
  		    {
073263
***************
073263
*** 8916,8923 ****
073263
  	{
073263
  	    if (noinvcurs)
073263
  		screen_stop_highlight();
073263
! 	    if (row == screen_cur_row && (col > screen_cur_col) &&
073263
! 								*T_CRI != NUL)
073263
  		term_cursor_right(col - screen_cur_col);
073263
  	    else
073263
  		term_windgoto(row, col);
073263
--- 8962,8969 ----
073263
  	{
073263
  	    if (noinvcurs)
073263
  		screen_stop_highlight();
073263
! 	    if (row == screen_cur_row && (col > screen_cur_col)
073263
! 							     && *T_CRI != NUL)
073263
  		term_cursor_right(col - screen_cur_col);
073263
  	    else
073263
  		term_windgoto(row, col);
073263
*** ../vim-7.4.337/src/structs.h	2014-06-17 17:48:21.784628008 +0200
073263
--- src/structs.h	2014-06-25 12:57:01.006115766 +0200
073263
***************
073263
*** 134,139 ****
073263
--- 134,145 ----
073263
      int		wo_arab;
073263
  # define w_p_arab w_onebuf_opt.wo_arab	/* 'arabic' */
073263
  #endif
073263
+ #ifdef FEAT_LINEBREAK
073263
+     int		wo_bri;
073263
+ # define w_p_bri w_onebuf_opt.wo_bri	/* 'breakindent' */
073263
+     char_u		*wo_briopt;
073263
+ # define w_p_briopt w_onebuf_opt.wo_briopt /* 'breakindentopt' */
073263
+ #endif
073263
  #ifdef FEAT_DIFF
073263
      int		wo_diff;
073263
  # define w_p_diff w_onebuf_opt.wo_diff	/* 'diff' */
073263
***************
073263
*** 2189,2194 ****
073263
--- 2195,2205 ----
073263
  #ifdef FEAT_SYN_HL
073263
      int		*w_p_cc_cols;	    /* array of columns to highlight or NULL */
073263
  #endif
073263
+ #ifdef FEAT_LINEBREAK
073263
+     int		w_p_brimin;	    /* minimum width for breakindent */
073263
+     int		w_p_brishift;	    /* additional shift for breakindent */
073263
+     int		w_p_brisbr;	    /* sbr in 'briopt' */
073263
+ #endif
073263
  
073263
      /* transform a pointer to a "onebuf" option into a "allbuf" option */
073263
  #define GLOBAL_WO(p)	((char *)p + sizeof(winopt_T))
073263
*** ../vim-7.4.337/src/testdir/Make_amiga.mak	2014-05-29 11:47:19.804773758 +0200
073263
--- src/testdir/Make_amiga.mak	2014-06-25 12:57:01.006115766 +0200
073263
***************
073263
*** 37,42 ****
073263
--- 37,43 ----
073263
  		test99.out test100.out test101.out test102.out test103.out \
073263
  		test104.out test105.out test106.out test107.out \
073263
  		test_autoformat_join.out \
073263
+ 		test_breakindent.out \
073263
  		test_eval.out \
073263
  		test_options.out
073263
  
073263
***************
073263
*** 163,167 ****
073263
--- 164,169 ----
073263
  test106.out: test106.in
073263
  test107.out: test107.in
073263
  test_autoformat_join.out: test_autoformat_join.in
073263
+ test_breakindent.out: test_breakindent.in
073263
  test_eval.out: test_eval.in
073263
  test_options.out: test_options.in
073263
*** ../vim-7.4.337/src/testdir/Make_dos.mak	2014-05-29 11:47:19.804773758 +0200
073263
--- src/testdir/Make_dos.mak	2014-06-25 12:57:01.006115766 +0200
073263
***************
073263
*** 36,41 ****
073263
--- 36,42 ----
073263
  		test100.out test101.out test102.out test103.out test104.out \
073263
  		test105.out test106.out  test107.out\
073263
  		test_autoformat_join.out \
073263
+ 		test_breakindent.out \
073263
  		test_eval.out \
073263
  		test_options.out
073263
  
073263
*** ../vim-7.4.337/src/testdir/Make_ming.mak	2014-05-29 11:47:19.804773758 +0200
073263
--- src/testdir/Make_ming.mak	2014-06-25 12:57:01.006115766 +0200
073263
***************
073263
*** 56,61 ****
073263
--- 56,62 ----
073263
  		test100.out test101.out test102.out test103.out test104.out \
073263
  		test105.out test106.out test107.out \
073263
  		test_autoformat_join.out \
073263
+ 		test_breakindent.out \
073263
  		test_eval.out \
073263
  		test_options.out
073263
  
073263
*** ../vim-7.4.337/src/testdir/Make_os2.mak	2014-05-29 11:47:19.804773758 +0200
073263
--- src/testdir/Make_os2.mak	2014-06-25 12:59:45.774121999 +0200
073263
***************
073263
*** 39,44 ****
073263
--- 39,45 ----
073263
  		test105.out test106.out test107.out \
073263
  		test_autoformat_join.out \
073263
  		test_eval.out \
073263
+ 		test_breakindent.out \
073263
  		test_options.out
073263
  
073263
  .SUFFIXES: .in .out
073263
*** ../vim-7.4.337/src/testdir/Make_vms.mms	2014-05-29 11:47:19.804773758 +0200
073263
--- src/testdir/Make_vms.mms	2014-06-25 12:57:01.006115766 +0200
073263
***************
073263
*** 97,102 ****
073263
--- 97,103 ----
073263
  	 test100.out test101.out test103.out test104.out \
073263
  	 test105.out test106.out test107.out \
073263
  	 test_autoformat_join.out \
073263
+ 	 test_breakindent.out \
073263
  	 test_eval.out \
073263
  	 test_options.out
073263
  
073263
*** ../vim-7.4.337/src/testdir/Makefile	2014-05-29 11:47:19.804773758 +0200
073263
--- src/testdir/Makefile	2014-06-25 12:57:01.006115766 +0200
073263
***************
073263
*** 34,39 ****
073263
--- 34,40 ----
073263
  		test99.out test100.out test101.out test102.out test103.out \
073263
  		test104.out test105.out test106.out test107.out \
073263
  		test_autoformat_join.out \
073263
+ 		test_breakindent.out \
073263
  		test_eval.out \
073263
  		test_options.out
073263
  
073263
*** ../vim-7.4.337/src/testdir/test_breakindent.in	2014-06-25 14:36:28.690341532 +0200
073263
--- src/testdir/test_breakindent.in	2014-06-25 14:26:00.994317785 +0200
073263
***************
073263
*** 0 ****
073263
--- 1,79 ----
073263
+ Test for breakindent
073263
+ 
073263
+ STARTTEST
073263
+ :so small.vim
073263
+ :if !exists("+breakindent") | e! test.ok | w! test.out | qa! | endif
073263
+ :10new|:vsp|:vert resize 20
073263
+ :put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\"
073263
+ :set ts=4 sw=4 sts=4 breakindent
073263
+ :fu! ScreenChar(width)
073263
+ :	let c=''
073263
+ :	for i in range(1,a:width)
073263
+ :		let c.=nr2char(screenchar(line('.'), i))
073263
+ :	endfor
073263
+ :       let c.="\n"
073263
+ :	for i in range(1,a:width)
073263
+ :		let c.=nr2char(screenchar(line('.')+1, i))
073263
+ :	endfor
073263
+ :       let c.="\n"
073263
+ :	for i in range(1,a:width)
073263
+ :		let c.=nr2char(screenchar(line('.')+2, i))
073263
+ :	endfor
073263
+ :	return c
073263
+ :endfu
073263
+ :fu DoRecordScreen()
073263
+ :	wincmd l
073263
+ :	$put =printf(\"\n%s\", g:test)
073263
+ :	$put =g:line1
073263
+ :	wincmd p
073263
+ :endfu
073263
+ :let g:test="Test 1: Simple breakindent"
073263
+ :let line1=ScreenChar(8)
073263
+ :call DoRecordScreen()
073263
+ :let g:test="Test 2: Simple breakindent + sbr=>>"
073263
+ :set sbr=>>
073263
+ :let line1=ScreenChar(8)
073263
+ :call DoRecordScreen()
073263
+ :let g:test ="Test 3: Simple breakindent + briopt:sbr"
073263
+ :set briopt=sbr,min:0 sbr=++
073263
+ :let line1=ScreenChar(8)
073263
+ :call DoRecordScreen()
073263
+ :let g:test ="Test 4: Simple breakindent + min width: 18"
073263
+ :set sbr= briopt=min:18
073263
+ :let line1=ScreenChar(8)
073263
+ :call DoRecordScreen()
073263
+ :let g:test =" Test 5: Simple breakindent + shift by 2"
073263
+ :set briopt=shift:2,min:0
073263
+ :let line1=ScreenChar(8)
073263
+ :call DoRecordScreen()
073263
+ :let g:test=" Test 6: Simple breakindent + shift by -1"
073263
+ :set briopt=shift:-1,min:0
073263
+ :let line1=ScreenChar(8)
073263
+ :call DoRecordScreen()
073263
+ :let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr"
073263
+ :set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4
073263
+ :let line1=ScreenChar(10)
073263
+ :call DoRecordScreen()
073263
+ :let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr"
073263
+ :set briopt=shift:1,sbr,min:0 nu sbr=# list
073263
+ :let line1=ScreenChar(10)
073263
+ :call DoRecordScreen()
073263
+ :let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list"
073263
+ :set briopt-=sbr
073263
+ :let line1=ScreenChar(10)
073263
+ :call DoRecordScreen()
073263
+ :let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n"
073263
+ :set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0
073263
+ :let line1=ScreenChar(10)
073263
+ :call DoRecordScreen()
073263
+ :wincmd p
073263
+ :let g:test="\n Test 11: strdisplaywidth when breakindent is on"
073263
+ :set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4
073263
+ :let text=getline(2) "skip leading tab when calculating text width
073263
+ :let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times
073263
+ :$put =g:test
073263
+ :$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)
073263
+ :%w! test.out
073263
+ :qa!
073263
+ ENDTEST
073263
+ dummy text
073263
*** ../vim-7.4.337/src/testdir/test_breakindent.ok	2014-06-25 14:36:28.698341532 +0200
073263
--- src/testdir/test_breakindent.ok	2014-06-25 12:57:01.006115766 +0200
073263
***************
073263
*** 0 ****
073263
--- 1,55 ----
073263
+ 
073263
+ 	abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP
073263
+ 
073263
+ Test 1: Simple breakindent
073263
+     abcd
073263
+     qrst
073263
+     GHIJ
073263
+ 
073263
+ Test 2: Simple breakindent + sbr=>>
073263
+     abcd
073263
+     >>qr
073263
+     >>EF
073263
+ 
073263
+ Test 3: Simple breakindent + briopt:sbr
073263
+     abcd
073263
+ ++  qrst
073263
+ ++  GHIJ
073263
+ 
073263
+ Test 4: Simple breakindent + min width: 18
073263
+     abcd
073263
+   qrstuv
073263
+   IJKLMN
073263
+ 
073263
+  Test 5: Simple breakindent + shift by 2
073263
+     abcd
073263
+       qr
073263
+       EF
073263
+ 
073263
+  Test 6: Simple breakindent + shift by -1
073263
+     abcd
073263
+    qrstu
073263
+    HIJKL
073263
+ 
073263
+  Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr
073263
+   2     ab
073263
+ ?        m
073263
+ ?        x
073263
+ 
073263
+  Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr
073263
+   2 ^Iabcd
073263
+ #      opq
073263
+ #      BCD
073263
+ 
073263
+  Test 9: breakindent + shift by +1 + 'nu' + sbr=# list
073263
+   2 ^Iabcd
073263
+        #op
073263
+        #AB
073263
+ 
073263
+  Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n
073263
+   2     ab
073263
+ ~       mn
073263
+ ~       yz
073263
+ 
073263
+  Test 11: strdisplaywidth when breakindent is on
073263
+ strdisplaywidth: 46 == calculated: 64
073263
*** ../vim-7.4.337/src/ui.c	2014-06-12 13:28:26.771694851 +0200
073263
--- src/ui.c	2014-06-25 13:22:20.218173240 +0200
073263
***************
073263
*** 3162,3176 ****
073263
      /* try to advance to the specified column */
073263
      int		count = 0;
073263
      char_u	*ptr;
073263
!     char_u	*start;
073263
  
073263
!     start = ptr = ml_get_buf(wp->w_buffer, lnum, FALSE);
073263
      while (count < vcol && *ptr != NUL)
073263
      {
073263
! 	count += win_lbr_chartabsize(wp, ptr, count, NULL);
073263
  	mb_ptr_adv(ptr);
073263
      }
073263
!     return (int)(ptr - start);
073263
  }
073263
  #endif
073263
  
073263
--- 3162,3176 ----
073263
      /* try to advance to the specified column */
073263
      int		count = 0;
073263
      char_u	*ptr;
073263
!     char_u	*line;
073263
  
073263
!     line = ptr = ml_get_buf(wp->w_buffer, lnum, FALSE);
073263
      while (count < vcol && *ptr != NUL)
073263
      {
073263
! 	count += win_lbr_chartabsize(wp, line, ptr, count, NULL);
073263
  	mb_ptr_adv(ptr);
073263
      }
073263
!     return (int)(ptr - line);
073263
  }
073263
  #endif
073263
  
073263
*** ../vim-7.4.337/src/version.c	2014-06-25 12:26:42.230046959 +0200
073263
--- src/version.c	2014-06-25 13:00:26.990123558 +0200
073263
***************
073263
*** 736,737 ****
073263
--- 736,739 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     338,
073263
  /**/
073263
073263
-- 
073263
MORTICIAN:    Bring out your dead!
073263
              [clang]
073263
              Bring out your dead!
073263
              [clang]
073263
              Bring out your dead!
073263
CUSTOMER:     Here's one -- nine pence.
073263
DEAD PERSON:  I'm not dead!
073263
                                  The Quest for the Holy Grail (Monty Python)
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///