home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.4 / 7.4.338 < prev    next >
Encoding:
Internet Message Format  |  2014-06-25  |  51.3 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.4.338
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.4.338
  11. Problem:    Cannot wrap lines taking indent into account.
  12. Solution:   Add the 'breakindent' option. (many authors, final improvements by
  13.         Christian Brabandt)
  14. Files:        runtime/doc/eval.txt, runtime/doc/options.txt, runtime/optwin.vim,
  15.         src/buffer.c, src/charset.c, src/edit.c, src/ex_getln.c,
  16.         src/getchar.c, src/misc1.c, src/misc2.c, src/ops.c, src/option.c,
  17.         src/option.h, src/proto/charset.pro, src/proto/misc1.pro,
  18.         src/proto/option.pro, src/screen.c, src/structs.h,
  19.         src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak,
  20.         src/testdir/Make_ming.mak, src/testdir/Make_os2.mak,
  21.         src/testdir/Make_vms.mms, src/testdir/Makefile,
  22.         src/testdir/test_breakindent.in, src/testdir/test_breakindent.ok,
  23.         src/ui.c
  24.  
  25.  
  26. *** ../vim-7.4.337/runtime/doc/eval.txt    2014-06-17 17:48:21.768628007 +0200
  27. --- runtime/doc/eval.txt    2014-06-25 12:57:00.986115765 +0200
  28. ***************
  29. *** 6639,6646 ****
  30.   keymap            Compiled with 'keymap' support.
  31.   langmap            Compiled with 'langmap' support.
  32.   libcall            Compiled with |libcall()| support.
  33. ! linebreak        Compiled with 'linebreak', 'breakat' and 'showbreak'
  34. !             support.
  35.   lispindent        Compiled with support for lisp indenting.
  36.   listcmds        Compiled with commands for the buffer list |:files|
  37.               and the argument list |arglist|.
  38. --- 6651,6658 ----
  39.   keymap            Compiled with 'keymap' support.
  40.   langmap            Compiled with 'langmap' support.
  41.   libcall            Compiled with |libcall()| support.
  42. ! linebreak        Compiled with 'linebreak', 'breakat', 'showbreak' and
  43. !             'breakindent' support.
  44.   lispindent        Compiled with support for lisp indenting.
  45.   listcmds        Compiled with commands for the buffer list |:files|
  46.               and the argument list |arglist|.
  47. *** ../vim-7.4.337/runtime/doc/options.txt    2014-06-17 17:48:21.768628007 +0200
  48. --- runtime/doc/options.txt    2014-06-25 12:57:00.986115765 +0200
  49. ***************
  50. *** 1200,1205 ****
  51. --- 1200,1237 ----
  52.       break if 'linebreak' is on.  Only works for ASCII and also for 8-bit
  53.       characters when 'encoding' is an 8-bit encoding.
  54.   
  55. +                         *'breakindent'* *'bri'*
  56. + 'breakindent' 'bri'    boolean (default off)
  57. +             local to window
  58. +             {not in Vi}
  59. +             {not available when compiled without the |+linebreak|
  60. +             feature}
  61. +     Every wrapped line will continue visually indented (same amount of
  62. +     space as the beginning of that line), thus preserving horizontal blocks
  63. +     of text.
  64. +                         *'breakindentopt'* *'briopt'*
  65. + 'breakindentopt' 'briopt' string (default empty)
  66. +             local to window
  67. +             {not in Vi}
  68. +             {not available when compiled without the |+linebreak|
  69. +             feature}
  70. +     Settings for 'breakindent'. It can consist of the following optional
  71. +     items and must be seperated by a comma:
  72. +         min:{n}        Minimum text width that will be kept after
  73. +                 applying 'breakindent', even if the resulting
  74. +                 text should normally be narrower. This prevents
  75. +                 text indented almost to the right window border
  76. +                 occupying lot of vertical space when broken.
  77. +         shift:{n}   After applying 'breakindent', wrapped line
  78. +                 beginning will be shift by given number of
  79. +                 characters. It permits dynamic French paragraph
  80. +                 indentation (negative) or emphasizing the line
  81. +                 continuation (positive).
  82. +         sbr        Display the 'showbreak' value before applying the 
  83. +                 additional indent.
  84. +     The default value for min is 20 and shift is 0.
  85.                           *'browsedir'* *'bsdir'*
  86.   'browsedir' 'bsdir'    string    (default: "last")
  87.               global
  88. *** ../vim-7.4.337/runtime/optwin.vim    2014-04-01 12:26:40.241157964 +0200
  89. --- runtime/optwin.vim    2014-06-25 12:57:00.990115765 +0200
  90. ***************
  91. *** 324,329 ****
  92. --- 324,335 ----
  93.   call append("$", "linebreak\twrap long lines at a character in 'breakat'")
  94.   call append("$", "\t(local to window)")
  95.   call <SID>BinOptionL("lbr")
  96. + call append("$", "breakindent\tpreserve indentation in wrapped text")
  97. + call append("$", "\t(local to window)")
  98. + call <SID>BinOptionL("bri")
  99. + call append("$", "breakindentopt\tadjust breakindent behaviour")
  100. + call append("$", "\t(local to window)")
  101. + call <SID>OptionL("briopt")
  102.   call append("$", "breakat\twhich characters might cause a line break")
  103.   call <SID>OptionG("brk", &brk)
  104.   call append("$", "showbreak\tstring to put before wrapped screen lines")
  105. *** ../vim-7.4.337/src/charset.c    2014-03-23 15:12:29.911264336 +0100
  106. --- src/charset.c    2014-06-25 13:23:05.842174966 +0200
  107. ***************
  108. *** 867,875 ****
  109.       char_u    *s;
  110.   {
  111.       colnr_T    col = startcol;
  112.   
  113.       while (*s != NUL)
  114. !     col += lbr_chartabsize_adv(&s, col);
  115.       return (int)col;
  116.   }
  117.   
  118. --- 867,876 ----
  119.       char_u    *s;
  120.   {
  121.       colnr_T    col = startcol;
  122. +     char_u    *line = s; /* pointer to start of line, for breakindent */
  123.   
  124.       while (*s != NUL)
  125. !     col += lbr_chartabsize_adv(line, &s, col);
  126.       return (int)col;
  127.   }
  128.   
  129. ***************
  130. *** 877,892 ****
  131.    * Like linetabsize(), but for a given window instead of the current one.
  132.    */
  133.       int
  134. ! win_linetabsize(wp, p, len)
  135.       win_T    *wp;
  136. !     char_u    *p;
  137.       colnr_T    len;
  138.   {
  139.       colnr_T    col = 0;
  140.       char_u    *s;
  141.   
  142. !     for (s = p; *s != NUL && (len == MAXCOL || s < p + len); mb_ptr_adv(s))
  143. !     col += win_lbr_chartabsize(wp, s, col, NULL);
  144.       return (int)col;
  145.   }
  146.   
  147. --- 878,894 ----
  148.    * Like linetabsize(), but for a given window instead of the current one.
  149.    */
  150.       int
  151. ! win_linetabsize(wp, line, len)
  152.       win_T    *wp;
  153. !     char_u    *line;
  154.       colnr_T    len;
  155.   {
  156.       colnr_T    col = 0;
  157.       char_u    *s;
  158.   
  159. !     for (s = line; *s != NUL && (len == MAXCOL || s < line + len);
  160. !                                 mb_ptr_adv(s))
  161. !     col += win_lbr_chartabsize(wp, line, s, col, NULL);
  162.       return (int)col;
  163.   }
  164.   
  165. ***************
  166. *** 1021,1032 ****
  167.    * like chartabsize(), but also check for line breaks on the screen
  168.    */
  169.       int
  170. ! lbr_chartabsize(s, col)
  171.       unsigned char    *s;
  172.       colnr_T        col;
  173.   {
  174.   #ifdef FEAT_LINEBREAK
  175. !     if (!curwin->w_p_lbr && *p_sbr == NUL)
  176.       {
  177.   #endif
  178.   #ifdef FEAT_MBYTE
  179. --- 1023,1035 ----
  180.    * like chartabsize(), but also check for line breaks on the screen
  181.    */
  182.       int
  183. ! lbr_chartabsize(line, s, col)
  184. !     char_u        *line; /* start of the line */
  185.       unsigned char    *s;
  186.       colnr_T        col;
  187.   {
  188.   #ifdef FEAT_LINEBREAK
  189. !     if (!curwin->w_p_lbr && *p_sbr == NUL && !curwin->w_p_bri)
  190.       {
  191.   #endif
  192.   #ifdef FEAT_MBYTE
  193. ***************
  194. *** 1036,1042 ****
  195.       RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col)
  196.   #ifdef FEAT_LINEBREAK
  197.       }
  198. !     return win_lbr_chartabsize(curwin, s, col, NULL);
  199.   #endif
  200.   }
  201.   
  202. --- 1039,1045 ----
  203.       RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col)
  204.   #ifdef FEAT_LINEBREAK
  205.       }
  206. !     return win_lbr_chartabsize(curwin, line == NULL ? s : line, s, col, NULL);
  207.   #endif
  208.   }
  209.   
  210. ***************
  211. *** 1044,1056 ****
  212.    * Call lbr_chartabsize() and advance the pointer.
  213.    */
  214.       int
  215. ! lbr_chartabsize_adv(s, col)
  216.       char_u    **s;
  217.       colnr_T    col;
  218.   {
  219.       int        retval;
  220.   
  221. !     retval = lbr_chartabsize(*s, col);
  222.       mb_ptr_adv(*s);
  223.       return retval;
  224.   }
  225. --- 1047,1060 ----
  226.    * Call lbr_chartabsize() and advance the pointer.
  227.    */
  228.       int
  229. ! lbr_chartabsize_adv(line, s, col)
  230. !     char_u    *line; /* start of the line */
  231.       char_u    **s;
  232.       colnr_T    col;
  233.   {
  234.       int        retval;
  235.   
  236. !     retval = lbr_chartabsize(line, *s, col);
  237.       mb_ptr_adv(*s);
  238.       return retval;
  239.   }
  240. ***************
  241. *** 1063,1070 ****
  242.    * value, init to 0 before calling.
  243.    */
  244.       int
  245. ! win_lbr_chartabsize(wp, s, col, headp)
  246.       win_T    *wp;
  247.       char_u    *s;
  248.       colnr_T    col;
  249.       int        *headp UNUSED;
  250. --- 1067,1075 ----
  251.    * value, init to 0 before calling.
  252.    */
  253.       int
  254. ! win_lbr_chartabsize(wp, line, s, col, headp)
  255.       win_T    *wp;
  256. +     char_u    *line; /* start of the line */
  257.       char_u    *s;
  258.       colnr_T    col;
  259.       int        *headp UNUSED;
  260. ***************
  261. *** 1086,1094 ****
  262.       int        n;
  263.   
  264.       /*
  265. !      * No 'linebreak' and 'showbreak': return quickly.
  266.        */
  267. !     if (!wp->w_p_lbr && *p_sbr == NUL)
  268.   #endif
  269.       {
  270.   #ifdef FEAT_MBYTE
  271. --- 1091,1099 ----
  272.       int        n;
  273.   
  274.       /*
  275. !      * No 'linebreak', 'showbreak' and 'breakindent': return quickly.
  276.        */
  277. !     if (!wp->w_p_lbr && !wp->w_p_bri && *p_sbr == NUL)
  278.   #endif
  279.       {
  280.   #ifdef FEAT_MBYTE
  281. ***************
  282. *** 1163,1173 ****
  283.   # endif
  284.   
  285.       /*
  286. !      * May have to add something for 'showbreak' string at start of line
  287.        * Set *headp to the size of what we add.
  288.        */
  289.       added = 0;
  290. !     if (*p_sbr != NUL && wp->w_p_wrap && col != 0)
  291.       {
  292.       numberextra = win_col_off(wp);
  293.       col += numberextra + mb_added;
  294. --- 1168,1179 ----
  295.   # endif
  296.   
  297.       /*
  298. !      * May have to add something for 'breakindent' and/or 'showbreak'
  299. !      * string at start of line.
  300.        * Set *headp to the size of what we add.
  301.        */
  302.       added = 0;
  303. !     if ((*p_sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && col != 0)
  304.       {
  305.       numberextra = win_col_off(wp);
  306.       col += numberextra + mb_added;
  307. ***************
  308. *** 1180,1186 ****
  309.       }
  310.       if (col == 0 || col + size > (colnr_T)W_WIDTH(wp))
  311.       {
  312. !         added = vim_strsize(p_sbr);
  313.           if (tab_corr)
  314.           size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts;
  315.           else
  316. --- 1186,1197 ----
  317.       }
  318.       if (col == 0 || col + size > (colnr_T)W_WIDTH(wp))
  319.       {
  320. !         added = 0;
  321. !         if (*p_sbr != NUL)
  322. !         added += vim_strsize(p_sbr);
  323. !         if (wp->w_p_bri)
  324. !         added += get_breakindent_win(wp, line);
  325.           if (tab_corr)
  326.           size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts;
  327.           else
  328. ***************
  329. *** 1274,1286 ****
  330.       colnr_T    vcol;
  331.       char_u    *ptr;        /* points to current char */
  332.       char_u    *posptr;    /* points to char at pos->col */
  333.       int        incr;
  334.       int        head;
  335.       int        ts = wp->w_buffer->b_p_ts;
  336.       int        c;
  337.   
  338.       vcol = 0;
  339. !     ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE);
  340.       if (pos->col == MAXCOL)
  341.       posptr = NULL;  /* continue until the NUL */
  342.       else
  343. --- 1285,1298 ----
  344.       colnr_T    vcol;
  345.       char_u    *ptr;        /* points to current char */
  346.       char_u    *posptr;    /* points to char at pos->col */
  347. +     char_u    *line;        /* start of the line */
  348.       int        incr;
  349.       int        head;
  350.       int        ts = wp->w_buffer->b_p_ts;
  351.       int        c;
  352.   
  353.       vcol = 0;
  354. !     line = ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE);
  355.       if (pos->col == MAXCOL)
  356.       posptr = NULL;  /* continue until the NUL */
  357.       else
  358. ***************
  359. *** 1288,1299 ****
  360.   
  361.       /*
  362.        * This function is used very often, do some speed optimizations.
  363. !      * When 'list', 'linebreak' and 'showbreak' are not set use a simple loop.
  364.        * Also use this when 'list' is set but tabs take their normal size.
  365.        */
  366.       if ((!wp->w_p_list || lcs_tab1 != NUL)
  367.   #ifdef FEAT_LINEBREAK
  368. !         && !wp->w_p_lbr && *p_sbr == NUL
  369.   #endif
  370.          )
  371.       {
  372. --- 1300,1312 ----
  373.   
  374.       /*
  375.        * This function is used very often, do some speed optimizations.
  376. !      * When 'list', 'linebreak', 'showbreak' and 'breakindent' are not set
  377. !      * use a simple loop.
  378.        * Also use this when 'list' is set but tabs take their normal size.
  379.        */
  380.       if ((!wp->w_p_list || lcs_tab1 != NUL)
  381.   #ifdef FEAT_LINEBREAK
  382. !         && !wp->w_p_lbr && *p_sbr == NUL && !wp->w_p_bri
  383.   #endif
  384.          )
  385.       {
  386. ***************
  387. *** 1355,1361 ****
  388.       {
  389.           /* A tab gets expanded, depending on the current column */
  390.           head = 0;
  391. !         incr = win_lbr_chartabsize(wp, ptr, vcol, &head);
  392.           /* make sure we don't go past the end of the line */
  393.           if (*ptr == NUL)
  394.           {
  395. --- 1368,1374 ----
  396.       {
  397.           /* A tab gets expanded, depending on the current column */
  398.           head = 0;
  399. !         incr = win_lbr_chartabsize(wp, line, ptr, vcol, &head);
  400.           /* make sure we don't go past the end of the line */
  401.           if (*ptr == NUL)
  402.           {
  403. *** ../vim-7.4.337/src/edit.c    2014-05-28 21:40:47.092329130 +0200
  404. --- src/edit.c    2014-06-25 13:16:43.278160493 +0200
  405. ***************
  406. *** 1956,1962 ****
  407.           else
  408.   #endif
  409.           ++new_cursor_col;
  410. !         vcol += lbr_chartabsize(ptr + new_cursor_col, (colnr_T)vcol);
  411.       }
  412.       vcol = last_vcol;
  413.   
  414. --- 1956,1962 ----
  415.           else
  416.   #endif
  417.           ++new_cursor_col;
  418. !         vcol += lbr_chartabsize(ptr, ptr + new_cursor_col, (colnr_T)vcol);
  419.       }
  420.       vcol = last_vcol;
  421.   
  422. ***************
  423. *** 7126,7134 ****
  424.       for (;;)
  425.       {
  426.           coladvance(v - width);
  427. !         /* getviscol() is slow, skip it when 'showbreak' is empty and
  428. !          * there are no multi-byte characters */
  429. !         if ((*p_sbr == NUL
  430.   #  ifdef FEAT_MBYTE
  431.               && !has_mbyte
  432.   #  endif
  433. --- 7126,7135 ----
  434.       for (;;)
  435.       {
  436.           coladvance(v - width);
  437. !         /* getviscol() is slow, skip it when 'showbreak' is empty,
  438. !          * 'breakindent' is not set and there are no multi-byte
  439. !          * characters */
  440. !         if ((*p_sbr == NUL && !curwin->w_p_bri
  441.   #  ifdef FEAT_MBYTE
  442.               && !has_mbyte
  443.   #  endif
  444. ***************
  445. *** 9758,9768 ****
  446.       getvcol(curwin, &fpos, &vcol, NULL, NULL);
  447.       getvcol(curwin, cursor, &want_vcol, NULL, NULL);
  448.   
  449. !     /* Use as many TABs as possible.  Beware of 'showbreak' and
  450. !      * 'linebreak' adding extra virtual columns. */
  451.       while (vim_iswhite(*ptr))
  452.       {
  453. !         i = lbr_chartabsize((char_u *)"\t", vcol);
  454.           if (vcol + i > want_vcol)
  455.           break;
  456.           if (*ptr != TAB)
  457. --- 9759,9769 ----
  458.       getvcol(curwin, &fpos, &vcol, NULL, NULL);
  459.       getvcol(curwin, cursor, &want_vcol, NULL, NULL);
  460.   
  461. !     /* Use as many TABs as possible.  Beware of 'breakindent', 'showbreak'
  462. !      * and 'linebreak' adding extra virtual columns. */
  463.       while (vim_iswhite(*ptr))
  464.       {
  465. !         i = lbr_chartabsize(NULL, (char_u *)"\t", vcol);
  466.           if (vcol + i > want_vcol)
  467.           break;
  468.           if (*ptr != TAB)
  469. ***************
  470. *** 9784,9794 ****
  471.       if (change_col >= 0)
  472.       {
  473.           int repl_off = 0;
  474.   
  475.           /* Skip over the spaces we need. */
  476.           while (vcol < want_vcol && *ptr == ' ')
  477.           {
  478. !         vcol += lbr_chartabsize(ptr, vcol);
  479.           ++ptr;
  480.           ++repl_off;
  481.           }
  482. --- 9785,9796 ----
  483.       if (change_col >= 0)
  484.       {
  485.           int repl_off = 0;
  486. +         char_u *line = ptr;
  487.   
  488.           /* Skip over the spaces we need. */
  489.           while (vcol < want_vcol && *ptr == ' ')
  490.           {
  491. !         vcol += lbr_chartabsize(line, ptr, vcol);
  492.           ++ptr;
  493.           ++repl_off;
  494.           }
  495. ***************
  496. *** 10029,10034 ****
  497. --- 10031,10037 ----
  498.       int        c;
  499.       int        temp;
  500.       char_u  *ptr, *prev_ptr;
  501. +     char_u  *line;
  502.   
  503.       if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count)
  504.       {
  505. ***************
  506. *** 10038,10050 ****
  507.   
  508.       /* try to advance to the cursor column */
  509.       temp = 0;
  510. !     ptr = ml_get(lnum);
  511.       prev_ptr = ptr;
  512.       validate_virtcol();
  513.       while ((colnr_T)temp < curwin->w_virtcol && *ptr != NUL)
  514.       {
  515.       prev_ptr = ptr;
  516. !     temp += lbr_chartabsize_adv(&ptr, (colnr_T)temp);
  517.       }
  518.       if ((colnr_T)temp > curwin->w_virtcol)
  519.       ptr = prev_ptr;
  520. --- 10041,10053 ----
  521.   
  522.       /* try to advance to the cursor column */
  523.       temp = 0;
  524. !     line = ptr = ml_get(lnum);
  525.       prev_ptr = ptr;
  526.       validate_virtcol();
  527.       while ((colnr_T)temp < curwin->w_virtcol && *ptr != NUL)
  528.       {
  529.       prev_ptr = ptr;
  530. !     temp += lbr_chartabsize_adv(line, &ptr, (colnr_T)temp);
  531.       }
  532.       if ((colnr_T)temp > curwin->w_virtcol)
  533.       ptr = prev_ptr;
  534. *** ../vim-7.4.337/src/ex_getln.c    2014-06-25 12:26:42.230046959 +0200
  535. --- src/ex_getln.c    2014-06-25 12:57:00.998115765 +0200
  536. ***************
  537. *** 2302,2311 ****
  538.   
  539.           p = (char_u *)line_ga.ga_data;
  540.           p[line_ga.ga_len] = NUL;
  541. !         indent = get_indent_str(p, 8);
  542.           indent += sw - indent % sw;
  543.   add_indent:
  544. !         while (get_indent_str(p, 8) < indent)
  545.           {
  546.               char_u *s = skipwhite(p);
  547.   
  548. --- 2302,2311 ----
  549.   
  550.           p = (char_u *)line_ga.ga_data;
  551.           p[line_ga.ga_len] = NUL;
  552. !         indent = get_indent_str(p, 8, FALSE);
  553.           indent += sw - indent % sw;
  554.   add_indent:
  555. !         while (get_indent_str(p, 8, FALSE) < indent)
  556.           {
  557.               char_u *s = skipwhite(p);
  558.   
  559. ***************
  560. *** 2357,2367 ****
  561.           else
  562.           {
  563.               p[line_ga.ga_len] = NUL;
  564. !             indent = get_indent_str(p, 8);
  565.               --indent;
  566.               indent -= indent % get_sw_value(curbuf);
  567.           }
  568. !         while (get_indent_str(p, 8) > indent)
  569.           {
  570.               char_u *s = skipwhite(p);
  571.   
  572. --- 2357,2367 ----
  573.           else
  574.           {
  575.               p[line_ga.ga_len] = NUL;
  576. !             indent = get_indent_str(p, 8, FALSE);
  577.               --indent;
  578.               indent -= indent % get_sw_value(curbuf);
  579.           }
  580. !         while (get_indent_str(p, 8, FALSE) > indent)
  581.           {
  582.               char_u *s = skipwhite(p);
  583.   
  584. *** ../vim-7.4.337/src/getchar.c    2014-05-22 18:59:54.510169240 +0200
  585. --- src/getchar.c    2014-06-25 13:16:53.946160896 +0200
  586. ***************
  587. *** 2675,2681 ****
  588.                   {
  589.                       if (!vim_iswhite(ptr[col]))
  590.                       curwin->w_wcol = vcol;
  591. !                     vcol += lbr_chartabsize(ptr + col,
  592.                                      (colnr_T)vcol);
  593.   #ifdef FEAT_MBYTE
  594.                       if (has_mbyte)
  595. --- 2675,2681 ----
  596.                   {
  597.                       if (!vim_iswhite(ptr[col]))
  598.                       curwin->w_wcol = vcol;
  599. !                     vcol += lbr_chartabsize(ptr, ptr + col,
  600.                                      (colnr_T)vcol);
  601.   #ifdef FEAT_MBYTE
  602.                       if (has_mbyte)
  603. *** ../vim-7.4.337/src/misc1.c    2014-05-22 14:00:12.698534712 +0200
  604. --- src/misc1.c    2014-06-25 13:39:43.598212712 +0200
  605. ***************
  606. *** 32,38 ****
  607.       int
  608.   get_indent()
  609.   {
  610. !     return get_indent_str(ml_get_curline(), (int)curbuf->b_p_ts);
  611.   }
  612.   
  613.   /*
  614. --- 32,38 ----
  615.       int
  616.   get_indent()
  617.   {
  618. !     return get_indent_str(ml_get_curline(), (int)curbuf->b_p_ts, FALSE);
  619.   }
  620.   
  621.   /*
  622. ***************
  623. *** 42,48 ****
  624.   get_indent_lnum(lnum)
  625.       linenr_T    lnum;
  626.   {
  627. !     return get_indent_str(ml_get(lnum), (int)curbuf->b_p_ts);
  628.   }
  629.   
  630.   #if defined(FEAT_FOLDING) || defined(PROTO)
  631. --- 42,48 ----
  632.   get_indent_lnum(lnum)
  633.       linenr_T    lnum;
  634.   {
  635. !     return get_indent_str(ml_get(lnum), (int)curbuf->b_p_ts, FALSE);
  636.   }
  637.   
  638.   #if defined(FEAT_FOLDING) || defined(PROTO)
  639. ***************
  640. *** 55,61 ****
  641.       buf_T    *buf;
  642.       linenr_T    lnum;
  643.   {
  644. !     return get_indent_str(ml_get_buf(buf, lnum, FALSE), (int)buf->b_p_ts);
  645.   }
  646.   #endif
  647.   
  648. --- 55,61 ----
  649.       buf_T    *buf;
  650.       linenr_T    lnum;
  651.   {
  652. !     return get_indent_str(ml_get_buf(buf, lnum, FALSE), (int)buf->b_p_ts, FALSE);
  653.   }
  654.   #endif
  655.   
  656. ***************
  657. *** 64,79 ****
  658.    * 'tabstop' at "ts"
  659.    */
  660.       int
  661. ! get_indent_str(ptr, ts)
  662.       char_u    *ptr;
  663.       int        ts;
  664.   {
  665.       int        count = 0;
  666.   
  667.       for ( ; *ptr; ++ptr)
  668.       {
  669. !     if (*ptr == TAB)    /* count a tab for what it is worth */
  670. !         count += ts - (count % ts);
  671.       else if (*ptr == ' ')
  672.           ++count;        /* count a space for one */
  673.       else
  674. --- 64,86 ----
  675.    * 'tabstop' at "ts"
  676.    */
  677.       int
  678. ! get_indent_str(ptr, ts, list)
  679.       char_u    *ptr;
  680.       int        ts;
  681. +     int        list; /* if TRUE, count only screen size for tabs */
  682.   {
  683.       int        count = 0;
  684.   
  685.       for ( ; *ptr; ++ptr)
  686.       {
  687. !     if (*ptr == TAB)
  688. !     {
  689. !         if (!list || lcs_tab1)    /* count a tab for what it is worth */
  690. !         count += ts - (count % ts);
  691. !         else
  692. !     /* in list mode, when tab is not set, count screen char width for Tab: ^I */
  693. !         count += ptr2cells(ptr);
  694. !     }
  695.       else if (*ptr == ' ')
  696.           ++count;        /* count a space for one */
  697.       else
  698. ***************
  699. *** 476,481 ****
  700. --- 483,540 ----
  701.       return (int)col;
  702.   }
  703.   
  704. + #if defined(FEAT_LINEBREAK) || defined(PROTO)
  705. + /*
  706. +  * Return appropriate space number for breakindent, taking influencing
  707. +  * parameters into account. Window must be specified, since it is not
  708. +  * necessarily always the current one.
  709. +  */
  710. +     int
  711. + get_breakindent_win(wp, line)
  712. +     win_T    *wp;
  713. +     char_u    *line; /* start of the line */
  714. + {
  715. +     static int        prev_indent = 0;  /* cached indent value */
  716. +     static long        prev_ts     = 0L; /* cached tabstop value */
  717. +     static char_u   *prev_line = NULL; /* cached pointer to line */
  718. +     int            bri = 0;
  719. +     /* window width minus window margin space, i.e. what rests for text */
  720. +     const int        eff_wwidth = W_WIDTH(wp)
  721. +                 - ((wp->w_p_nu || wp->w_p_rnu)
  722. +                 && (vim_strchr(p_cpo, CPO_NUMCOL) == NULL)
  723. +                         ? number_width(wp) + 1 : 0);
  724. +     /* used cached indent, unless pointer or 'tabstop' changed */
  725. +     if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts)
  726. +     {
  727. +     prev_line = line;
  728. +     prev_ts = wp->w_buffer->b_p_ts;
  729. +     prev_indent = get_indent_str(line,
  730. +           (int)wp->w_buffer->b_p_ts, wp->w_p_list) + wp->w_p_brishift;
  731. +     }
  732. +     /* indent minus the length of the showbreak string */
  733. +     bri = prev_indent;
  734. +     if (wp->w_p_brisbr)
  735. +     bri -= vim_strsize(p_sbr);
  736. +     /* Add offset for number column, if 'n' is in 'cpoptions' */
  737. +     bri += win_col_off2(wp);
  738. +     /* never indent past left window margin */
  739. +     if (bri < 0)
  740. +     bri = 0;
  741. +     /* always leave at least bri_min characters on the left,
  742. +      * if text width is sufficient */
  743. +     else if (bri > eff_wwidth - wp->w_p_brimin)
  744. +     bri = (eff_wwidth - wp->w_p_brimin < 0)
  745. +                 ? 0 : eff_wwidth - wp->w_p_brimin;
  746. +     return bri;
  747. + }
  748. + #endif
  749.   #if defined(FEAT_CINDENT) || defined(FEAT_SMARTINDENT)
  750.   
  751.   static int cin_is_cinword __ARGS((char_u *line));
  752. ***************
  753. *** 678,684 ****
  754.       /*
  755.        * count white space on current line
  756.        */
  757. !     newindent = get_indent_str(saved_line, (int)curbuf->b_p_ts);
  758.       if (newindent == 0 && !(flags & OPENLINE_COM_LIST))
  759.           newindent = second_line_indent; /* for ^^D command in insert mode */
  760.   
  761. --- 737,743 ----
  762.       /*
  763.        * count white space on current line
  764.        */
  765. !     newindent = get_indent_str(saved_line, (int)curbuf->b_p_ts, FALSE);
  766.       if (newindent == 0 && !(flags & OPENLINE_COM_LIST))
  767.           newindent = second_line_indent; /* for ^^D command in insert mode */
  768.   
  769. ***************
  770. *** 1201,1207 ****
  771.                       || do_si
  772.   #endif
  773.                                  )
  774. !             newindent = get_indent_str(leader, (int)curbuf->b_p_ts);
  775.   
  776.               /* Add the indent offset */
  777.               if (newindent + off < 0)
  778. --- 1260,1266 ----
  779.                       || do_si
  780.   #endif
  781.                                  )
  782. !             newindent = get_indent_str(leader, (int)curbuf->b_p_ts, FALSE);
  783.   
  784.               /* Add the indent offset */
  785.               if (newindent + off < 0)
  786. ***************
  787. *** 1994,1999 ****
  788. --- 2053,2059 ----
  789.       char_u    *s;
  790.       int        lines = 0;
  791.       int        width;
  792. +     char_u    *line;
  793.   
  794.   #ifdef FEAT_DIFF
  795.       /* Check for filler lines above this buffer line.  When folded the result
  796. ***************
  797. *** 2009,2020 ****
  798.       return lines + 1;
  799.   #endif
  800.   
  801. !     s = ml_get_buf(wp->w_buffer, lnum, FALSE);
  802.   
  803.       col = 0;
  804.       while (*s != NUL && --column >= 0)
  805.       {
  806. !     col += win_lbr_chartabsize(wp, s, (colnr_T)col, NULL);
  807.       mb_ptr_adv(s);
  808.       }
  809.   
  810. --- 2069,2080 ----
  811.       return lines + 1;
  812.   #endif
  813.   
  814. !     line = s = ml_get_buf(wp->w_buffer, lnum, FALSE);
  815.   
  816.       col = 0;
  817.       while (*s != NUL && --column >= 0)
  818.       {
  819. !     col += win_lbr_chartabsize(wp, line, s, (colnr_T)col, NULL);
  820.       mb_ptr_adv(s);
  821.       }
  822.   
  823. ***************
  824. *** 2026,2032 ****
  825.        * 'ts') -- webb.
  826.        */
  827.       if (*s == TAB && (State & NORMAL) && (!wp->w_p_list || lcs_tab1))
  828. !     col += win_lbr_chartabsize(wp, s, (colnr_T)col, NULL) - 1;
  829.   
  830.       /*
  831.        * Add column offset for 'number', 'relativenumber', 'foldcolumn', etc.
  832. --- 2086,2092 ----
  833.        * 'ts') -- webb.
  834.        */
  835.       if (*s == TAB && (State & NORMAL) && (!wp->w_p_list || lcs_tab1))
  836. !     col += win_lbr_chartabsize(wp, line, s, (colnr_T)col, NULL) - 1;
  837.   
  838.       /*
  839.        * Add column offset for 'number', 'relativenumber', 'foldcolumn', etc.
  840. ***************
  841. *** 9002,9011 ****
  842.           amount = 2;
  843.           else
  844.           {
  845.           amount = 0;
  846.           while (*that && col)
  847.           {
  848. !             amount += lbr_chartabsize_adv(&that, (colnr_T)amount);
  849.               col--;
  850.           }
  851.   
  852. --- 9062,9073 ----
  853.           amount = 2;
  854.           else
  855.           {
  856. +         char_u *line = that;
  857.           amount = 0;
  858.           while (*that && col)
  859.           {
  860. !             amount += lbr_chartabsize_adv(line, &that, (colnr_T)amount);
  861.               col--;
  862.           }
  863.   
  864. ***************
  865. *** 9028,9034 ****
  866.   
  867.               while (vim_iswhite(*that))
  868.               {
  869. !             amount += lbr_chartabsize(that, (colnr_T)amount);
  870.               ++that;
  871.               }
  872.   
  873. --- 9090,9096 ----
  874.   
  875.               while (vim_iswhite(*that))
  876.               {
  877. !             amount += lbr_chartabsize(line, that, (colnr_T)amount);
  878.               ++that;
  879.               }
  880.   
  881. ***************
  882. *** 9066,9080 ****
  883.                                      && !quotecount)
  884.                       --parencount;
  885.                   if (*that == '\\' && *(that+1) != NUL)
  886. !                     amount += lbr_chartabsize_adv(&that,
  887. !                                  (colnr_T)amount);
  888. !                 amount += lbr_chartabsize_adv(&that,
  889. !                                  (colnr_T)amount);
  890.                   }
  891.               }
  892.               while (vim_iswhite(*that))
  893.               {
  894. !                 amount += lbr_chartabsize(that, (colnr_T)amount);
  895.                   that++;
  896.               }
  897.               if (!*that || *that == ';')
  898. --- 9128,9143 ----
  899.                                      && !quotecount)
  900.                       --parencount;
  901.                   if (*that == '\\' && *(that+1) != NUL)
  902. !                     amount += lbr_chartabsize_adv(
  903. !                         line, &that, (colnr_T)amount);
  904. !                 amount += lbr_chartabsize_adv(
  905. !                         line, &that, (colnr_T)amount);
  906.                   }
  907.               }
  908.               while (vim_iswhite(*that))
  909.               {
  910. !                 amount += lbr_chartabsize(
  911. !                          line, that, (colnr_T)amount);
  912.                   that++;
  913.               }
  914.               if (!*that || *that == ';')
  915. *** ../vim-7.4.337/src/misc2.c    2014-05-07 18:35:25.669216052 +0200
  916. --- src/misc2.c    2014-06-25 13:21:18.474170904 +0200
  917. ***************
  918. *** 201,210 ****
  919.       {
  920.           /* Count a tab for what it's worth (if list mode not on) */
  921.   #ifdef FEAT_LINEBREAK
  922. !         csize = win_lbr_chartabsize(curwin, ptr, col, &head);
  923.           mb_ptr_adv(ptr);
  924.   #else
  925. !         csize = lbr_chartabsize_adv(&ptr, col);
  926.   #endif
  927.           col += csize;
  928.       }
  929. --- 201,210 ----
  930.       {
  931.           /* Count a tab for what it's worth (if list mode not on) */
  932.   #ifdef FEAT_LINEBREAK
  933. !         csize = win_lbr_chartabsize(curwin, line, ptr, col, &head);
  934.           mb_ptr_adv(ptr);
  935.   #else
  936. !         csize = lbr_chartabsize_adv(line, &ptr, col);
  937.   #endif
  938.           col += csize;
  939.       }
  940. ***************
  941. *** 2156,2162 ****
  942.       }
  943.   }
  944.   
  945. ! #if (defined(UNIX) && !defined(USE_SYSTEM)) || defined(WIN3264)
  946.   /*
  947.    * Append the text in "gap" below the cursor line and clear "gap".
  948.    */
  949. --- 2156,2163 ----
  950.       }
  951.   }
  952.   
  953. ! #if (defined(UNIX) && !defined(USE_SYSTEM)) || defined(WIN3264) \
  954. !     || defined(PROTO)
  955.   /*
  956.    * Append the text in "gap" below the cursor line and clear "gap".
  957.    */
  958. *** ../vim-7.4.337/src/ops.c    2014-06-17 18:16:08.420691059 +0200
  959. --- src/ops.c    2014-06-25 13:18:27.082164420 +0200
  960. ***************
  961. *** 420,426 ****
  962.       }
  963.       for ( ; vim_iswhite(*bd.textstart); )
  964.       {
  965. !         incr = lbr_chartabsize_adv(&bd.textstart, (colnr_T)(bd.start_vcol));
  966.           total += incr;
  967.           bd.start_vcol += incr;
  968.       }
  969. --- 420,428 ----
  970.       }
  971.       for ( ; vim_iswhite(*bd.textstart); )
  972.       {
  973. !         /* TODO: is passing bd.textstart for start of the line OK? */
  974. !         incr = lbr_chartabsize_adv(bd.textstart, &bd.textstart,
  975. !                             (colnr_T)(bd.start_vcol));
  976.           total += incr;
  977.           bd.start_vcol += incr;
  978.       }
  979. ***************
  980. *** 480,486 ****
  981.   
  982.       while (vim_iswhite(*non_white))
  983.       {
  984. !         incr = lbr_chartabsize_adv(&non_white, non_white_col);
  985.           non_white_col += incr;
  986.       }
  987.   
  988. --- 482,488 ----
  989.   
  990.       while (vim_iswhite(*non_white))
  991.       {
  992. !         incr = lbr_chartabsize_adv(bd.textstart, &non_white, non_white_col);
  993.           non_white_col += incr;
  994.       }
  995.   
  996. ***************
  997. *** 505,511 ****
  998.           verbatim_copy_width -= bd.start_char_vcols;
  999.       while (verbatim_copy_width < destination_col)
  1000.       {
  1001. !         incr = lbr_chartabsize(verbatim_copy_end, verbatim_copy_width);
  1002.           if (verbatim_copy_width + incr > destination_col)
  1003.           break;
  1004.           verbatim_copy_width += incr;
  1005. --- 507,517 ----
  1006.           verbatim_copy_width -= bd.start_char_vcols;
  1007.       while (verbatim_copy_width < destination_col)
  1008.       {
  1009. !         char_u *line = verbatim_copy_end;
  1010. !         /* TODO: is passing verbatim_copy_end for start of the line OK? */
  1011. !         incr = lbr_chartabsize(line, verbatim_copy_end,
  1012. !                              verbatim_copy_width);
  1013.           if (verbatim_copy_width + incr > destination_col)
  1014.           break;
  1015.           verbatim_copy_width += incr;
  1016. ***************
  1017. *** 3617,3623 ****
  1018.           for (ptr = oldp; vcol < col && *ptr; )
  1019.           {
  1020.           /* Count a tab for what it's worth (if list mode not on) */
  1021. !         incr = lbr_chartabsize_adv(&ptr, (colnr_T)vcol);
  1022.           vcol += incr;
  1023.           }
  1024.           bd.textcol = (colnr_T)(ptr - oldp);
  1025. --- 3623,3629 ----
  1026.           for (ptr = oldp; vcol < col && *ptr; )
  1027.           {
  1028.           /* Count a tab for what it's worth (if list mode not on) */
  1029. !         incr = lbr_chartabsize_adv(oldp, &ptr, (colnr_T)vcol);
  1030.           vcol += incr;
  1031.           }
  1032.           bd.textcol = (colnr_T)(ptr - oldp);
  1033. ***************
  1034. *** 3651,3657 ****
  1035.           /* calculate number of spaces required to fill right side of block*/
  1036.           spaces = y_width + 1;
  1037.           for (j = 0; j < yanklen; j++)
  1038. !         spaces -= lbr_chartabsize(&y_array[i][j], 0);
  1039.           if (spaces < 0)
  1040.           spaces = 0;
  1041.   
  1042. --- 3657,3663 ----
  1043.           /* calculate number of spaces required to fill right side of block*/
  1044.           spaces = y_width + 1;
  1045.           for (j = 0; j < yanklen; j++)
  1046. !         spaces -= lbr_chartabsize(NULL, &y_array[i][j], 0);
  1047.           if (spaces < 0)
  1048.           spaces = 0;
  1049.   
  1050. ***************
  1051. *** 5203,5209 ****
  1052.       while (bdp->start_vcol < oap->start_vcol && *pstart)
  1053.       {
  1054.       /* Count a tab for what it's worth (if list mode not on) */
  1055. !     incr = lbr_chartabsize(pstart, (colnr_T)bdp->start_vcol);
  1056.       bdp->start_vcol += incr;
  1057.   #ifdef FEAT_VISUALEXTRA
  1058.       if (vim_iswhite(*pstart))
  1059. --- 5209,5215 ----
  1060.       while (bdp->start_vcol < oap->start_vcol && *pstart)
  1061.       {
  1062.       /* Count a tab for what it's worth (if list mode not on) */
  1063. !     incr = lbr_chartabsize(line, pstart, (colnr_T)bdp->start_vcol);
  1064.       bdp->start_vcol += incr;
  1065.   #ifdef FEAT_VISUALEXTRA
  1066.       if (vim_iswhite(*pstart))
  1067. ***************
  1068. *** 5272,5278 ****
  1069.           {
  1070.           /* Count a tab for what it's worth (if list mode not on) */
  1071.           prev_pend = pend;
  1072. !         incr = lbr_chartabsize_adv(&pend, (colnr_T)bdp->end_vcol);
  1073.           bdp->end_vcol += incr;
  1074.           }
  1075.           if (bdp->end_vcol <= oap->end_vcol
  1076. --- 5278,5287 ----
  1077.           {
  1078.           /* Count a tab for what it's worth (if list mode not on) */
  1079.           prev_pend = pend;
  1080. !         /* TODO: is passing prev_pend for start of the line OK?
  1081. !          * perhaps it should be "line". */
  1082. !         incr = lbr_chartabsize_adv(prev_pend, &pend,
  1083. !                               (colnr_T)bdp->end_vcol);
  1084.           bdp->end_vcol += incr;
  1085.           }
  1086.           if (bdp->end_vcol <= oap->end_vcol
  1087. ***************
  1088. *** 6882,6888 ****
  1089.           validate_virtcol();
  1090.           col_print(buf1, sizeof(buf1), (int)curwin->w_cursor.col + 1,
  1091.               (int)curwin->w_virtcol + 1);
  1092. !         col_print(buf2, sizeof(buf2), (int)STRLEN(p), linetabsize(p));
  1093.   
  1094.           if (char_count_cursor == byte_count_cursor
  1095.               && char_count == byte_count)
  1096. --- 6891,6898 ----
  1097.           validate_virtcol();
  1098.           col_print(buf1, sizeof(buf1), (int)curwin->w_cursor.col + 1,
  1099.               (int)curwin->w_virtcol + 1);
  1100. !         col_print(buf2, sizeof(buf2), (int)STRLEN(p),
  1101. !                 linetabsize(p));
  1102.   
  1103.           if (char_count_cursor == byte_count_cursor
  1104.               && char_count == byte_count)
  1105. *** ../vim-7.4.337/src/option.c    2014-06-25 11:48:40.733960646 +0200
  1106. --- src/option.c    2014-06-25 14:31:41.630330672 +0200
  1107. ***************
  1108. *** 188,193 ****
  1109. --- 188,197 ----
  1110.   #ifdef FEAT_ARABIC
  1111.   # define PV_ARAB    OPT_WIN(WV_ARAB)
  1112.   #endif
  1113. + #ifdef FEAT_LINEBREAK
  1114. + # define PV_BRI        OPT_WIN(WV_BRI)
  1115. + # define PV_BRIOPT    OPT_WIN(WV_BRIOPT)
  1116. + #endif
  1117.   #ifdef FEAT_DIFF
  1118.   # define PV_DIFF    OPT_WIN(WV_DIFF)
  1119.   #endif
  1120. ***************
  1121. *** 648,653 ****
  1122. --- 652,675 ----
  1123.                   {(char_u *)0L, (char_u *)0L}
  1124.   #endif
  1125.                   SCRIPTID_INIT},
  1126. +     {"breakindent",   "bri",  P_BOOL|P_VI_DEF|P_VIM|P_RWIN,
  1127. + #ifdef FEAT_LINEBREAK
  1128. +                 (char_u *)VAR_WIN, PV_BRI,
  1129. +                 {(char_u *)FALSE, (char_u *)0L}
  1130. + #else
  1131. +                 (char_u *)NULL, PV_NONE,
  1132. +                 {(char_u *)0L, (char_u *)0L}
  1133. + #endif
  1134. +                 SCRIPTID_INIT},
  1135. +     {"breakindentopt", "briopt", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_COMMA|P_NODUP,
  1136. + #ifdef FEAT_LINEBREAK
  1137. +                 (char_u *)VAR_WIN, PV_BRIOPT,
  1138. +                 {(char_u *)"", (char_u *)NULL}
  1139. + #else
  1140. +                 (char_u *)NULL, PV_NONE,
  1141. +                 {(char_u *)"", (char_u *)NULL}
  1142. + #endif
  1143. +                 SCRIPTID_INIT},
  1144.       {"browsedir",   "bsdir",P_STRING|P_VI_DEF,
  1145.   #ifdef FEAT_BROWSE
  1146.                   (char_u *)&p_bsdir, PV_NONE,
  1147. ***************
  1148. *** 5256,5261 ****
  1149. --- 5278,5286 ----
  1150.       /* set cedit_key */
  1151.       (void)check_cedit();
  1152.   #endif
  1153. + #ifdef FEAT_LINEBREAK
  1154. +     briopt_check();
  1155. + #endif
  1156.   }
  1157.   
  1158.   /*
  1159. ***************
  1160. *** 5709,5714 ****
  1161. --- 5734,5747 ----
  1162.                *p_pm == '.' ? p_pm + 1 : p_pm) == 0)
  1163.           errmsg = (char_u *)N_("E589: 'backupext' and 'patchmode' are equal");
  1164.       }
  1165. + #ifdef FEAT_LINEBREAK
  1166. +     /* 'breakindentopt' */
  1167. +     else if (varp == &curwin->w_p_briopt)
  1168. +     {
  1169. +     if (briopt_check() == FAIL)
  1170. +         errmsg = e_invarg;
  1171. +     }
  1172. + #endif
  1173.   
  1174.       /*
  1175.        * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[]
  1176. ***************
  1177. *** 10018,10023 ****
  1178. --- 10051,10058 ----
  1179.       case PV_WRAP:    return (char_u *)&(curwin->w_p_wrap);
  1180.   #ifdef FEAT_LINEBREAK
  1181.       case PV_LBR:    return (char_u *)&(curwin->w_p_lbr);
  1182. +     case PV_BRI:    return (char_u *)&(curwin->w_p_bri);
  1183. +     case PV_BRIOPT: return (char_u *)&(curwin->w_p_briopt);
  1184.   #endif
  1185.   #ifdef FEAT_SCROLLBIND
  1186.       case PV_SCBIND: return (char_u *)&(curwin->w_p_scb);
  1187. ***************
  1188. *** 10207,10212 ****
  1189. --- 10242,10249 ----
  1190.   #endif
  1191.   #ifdef FEAT_LINEBREAK
  1192.       to->wo_lbr = from->wo_lbr;
  1193. +     to->wo_bri = from->wo_bri;
  1194. +     to->wo_briopt = vim_strsave(from->wo_briopt);
  1195.   #endif
  1196.   #ifdef FEAT_SCROLLBIND
  1197.       to->wo_scb = from->wo_scb;
  1198. ***************
  1199. *** 10294,10299 ****
  1200. --- 10331,10339 ----
  1201.   #ifdef FEAT_CONCEAL
  1202.       check_string_option(&wop->wo_cocu);
  1203.   #endif
  1204. + #ifdef FEAT_LINEBREAK
  1205. +     check_string_option(&wop->wo_briopt);
  1206. + #endif
  1207.   }
  1208.   
  1209.   /*
  1210. ***************
  1211. *** 10313,10318 ****
  1212. --- 10353,10361 ----
  1213.   # endif
  1214.       clear_string_option(&wop->wo_fmr);
  1215.   #endif
  1216. + #ifdef FEAT_LINEBREAK
  1217. +     clear_string_option(&wop->wo_briopt);
  1218. + #endif
  1219.   #ifdef FEAT_RIGHTLEFT
  1220.       clear_string_option(&wop->wo_rlc);
  1221.   #endif
  1222. ***************
  1223. *** 11927,11929 ****
  1224. --- 11970,12018 ----
  1225.           ++ptr;
  1226.       }
  1227.   }
  1228. + #if defined(FEAT_LINEBREAK) || defined(PROTO)
  1229. + /*
  1230. +  * This is called when 'breakindentopt' is changed and when a window is
  1231. +  * initialized.
  1232. +  */
  1233. +     int
  1234. + briopt_check()
  1235. + {
  1236. +     char_u    *p;
  1237. +     int        bri_shift = 0;
  1238. +     long    bri_min = 20;
  1239. +     int        bri_sbr = FALSE;
  1240. +     p = curwin->w_p_briopt;
  1241. +     while (*p != NUL)
  1242. +     {
  1243. +     if (STRNCMP(p, "shift:", 6) == 0
  1244. +          && ((p[6] == '-' && VIM_ISDIGIT(p[7])) || VIM_ISDIGIT(p[6])))
  1245. +     {
  1246. +         p += 6;
  1247. +         bri_shift = getdigits(&p);
  1248. +     }
  1249. +     else if (STRNCMP(p, "min:", 4) == 0 && VIM_ISDIGIT(p[4]))
  1250. +     {
  1251. +         p += 4;
  1252. +         bri_min = getdigits(&p);
  1253. +     }
  1254. +     else if (STRNCMP(p, "sbr", 3) == 0)
  1255. +     {
  1256. +         p += 3;
  1257. +         bri_sbr = TRUE;
  1258. +     }
  1259. +     if (*p != ',' && *p != NUL)
  1260. +         return FAIL;
  1261. +     if (*p == ',')
  1262. +         ++p;
  1263. +     }
  1264. +     curwin->w_p_brishift = bri_shift;
  1265. +     curwin->w_p_brimin   = bri_min;
  1266. +     curwin->w_p_brisbr   = bri_sbr;
  1267. +     return OK;
  1268. + }
  1269. + #endif
  1270. *** ../vim-7.4.337/src/option.h    2014-05-28 21:40:47.092329130 +0200
  1271. --- src/option.h    2014-06-25 12:57:01.002115765 +0200
  1272. ***************
  1273. *** 1052,1057 ****
  1274. --- 1052,1061 ----
  1275.   #ifdef FEAT_CURSORBIND
  1276.       , WV_CRBIND
  1277.   #endif
  1278. + #ifdef FEAT_LINEBREAK
  1279. +     , WV_BRI
  1280. +     , WV_BRIOPT
  1281. + #endif
  1282.   #ifdef FEAT_DIFF
  1283.       , WV_DIFF
  1284.   #endif
  1285. *** ../vim-7.4.337/src/proto/charset.pro    2013-08-10 13:37:07.000000000 +0200
  1286. --- src/proto/charset.pro    2014-06-25 13:22:32.934173721 +0200
  1287. ***************
  1288. *** 16,22 ****
  1289.   int chartabsize __ARGS((char_u *p, colnr_T col));
  1290.   int linetabsize __ARGS((char_u *s));
  1291.   int linetabsize_col __ARGS((int startcol, char_u *s));
  1292. ! int win_linetabsize __ARGS((win_T *wp, char_u *p, colnr_T len));
  1293.   int vim_isIDc __ARGS((int c));
  1294.   int vim_iswordc __ARGS((int c));
  1295.   int vim_iswordc_buf __ARGS((int c, buf_T *buf));
  1296. --- 16,22 ----
  1297.   int chartabsize __ARGS((char_u *p, colnr_T col));
  1298.   int linetabsize __ARGS((char_u *s));
  1299.   int linetabsize_col __ARGS((int startcol, char_u *s));
  1300. ! int win_linetabsize __ARGS((win_T *wp, char_u *line, colnr_T len));
  1301.   int vim_isIDc __ARGS((int c));
  1302.   int vim_iswordc __ARGS((int c));
  1303.   int vim_iswordc_buf __ARGS((int c, buf_T *buf));
  1304. ***************
  1305. *** 26,34 ****
  1306.   int vim_isfilec_or_wc __ARGS((int c));
  1307.   int vim_isprintc __ARGS((int c));
  1308.   int vim_isprintc_strict __ARGS((int c));
  1309. ! int lbr_chartabsize __ARGS((unsigned char *s, colnr_T col));
  1310. ! int lbr_chartabsize_adv __ARGS((char_u **s, colnr_T col));
  1311. ! int win_lbr_chartabsize __ARGS((win_T *wp, char_u *s, colnr_T col, int *headp));
  1312.   int in_win_border __ARGS((win_T *wp, colnr_T vcol));
  1313.   void getvcol __ARGS((win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end));
  1314.   colnr_T getvcol_nolist __ARGS((pos_T *posp));
  1315. --- 26,34 ----
  1316.   int vim_isfilec_or_wc __ARGS((int c));
  1317.   int vim_isprintc __ARGS((int c));
  1318.   int vim_isprintc_strict __ARGS((int c));
  1319. ! int lbr_chartabsize __ARGS((char_u *line, unsigned char *s, colnr_T col));
  1320. ! int lbr_chartabsize_adv __ARGS((char_u *line, char_u **s, colnr_T col));
  1321. ! int win_lbr_chartabsize __ARGS((win_T *wp, char_u *line, char_u *s, colnr_T col, int *headp));
  1322.   int in_win_border __ARGS((win_T *wp, colnr_T vcol));
  1323.   void getvcol __ARGS((win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end));
  1324.   colnr_T getvcol_nolist __ARGS((pos_T *posp));
  1325. *** ../vim-7.4.337/src/proto/misc1.pro    2014-05-07 15:10:17.661108310 +0200
  1326. --- src/proto/misc1.pro    2014-06-25 12:57:01.002115765 +0200
  1327. ***************
  1328. *** 2,10 ****
  1329.   int get_indent __ARGS((void));
  1330.   int get_indent_lnum __ARGS((linenr_T lnum));
  1331.   int get_indent_buf __ARGS((buf_T *buf, linenr_T lnum));
  1332. ! int get_indent_str __ARGS((char_u *ptr, int ts));
  1333.   int set_indent __ARGS((int size, int flags));
  1334.   int get_number_indent __ARGS((linenr_T lnum));
  1335.   int open_line __ARGS((int dir, int flags, int second_line_indent));
  1336.   int get_leader_len __ARGS((char_u *line, char_u **flags, int backward, int include_space));
  1337.   int get_last_leader_offset __ARGS((char_u *line, char_u **flags));
  1338. --- 2,11 ----
  1339.   int get_indent __ARGS((void));
  1340.   int get_indent_lnum __ARGS((linenr_T lnum));
  1341.   int get_indent_buf __ARGS((buf_T *buf, linenr_T lnum));
  1342. ! int get_indent_str __ARGS((char_u *ptr, int ts, int list));
  1343.   int set_indent __ARGS((int size, int flags));
  1344.   int get_number_indent __ARGS((linenr_T lnum));
  1345. + int get_breakindent_win __ARGS((win_T *wp, char_u *ptr));
  1346.   int open_line __ARGS((int dir, int flags, int second_line_indent));
  1347.   int get_leader_len __ARGS((char_u *line, char_u **flags, int backward, int include_space));
  1348.   int get_last_leader_offset __ARGS((char_u *line, char_u **flags));
  1349. *** ../vim-7.4.337/src/proto/option.pro    2014-01-14 16:54:53.000000000 +0100
  1350. --- src/proto/option.pro    2014-06-25 14:16:04.882295233 +0200
  1351. ***************
  1352. *** 63,66 ****
  1353. --- 63,67 ----
  1354.   long get_sw_value __ARGS((buf_T *buf));
  1355.   long get_sts_value __ARGS((void));
  1356.   void find_mps_values __ARGS((int *initc, int *findc, int *backwards, int switchit));
  1357. + int briopt_check __ARGS((void));
  1358.   /* vim: set ft=c : */
  1359. *** ../vim-7.4.337/src/screen.c    2014-06-18 21:20:07.232377308 +0200
  1360. --- src/screen.c    2014-06-25 13:43:39.930221653 +0200
  1361. ***************
  1362. *** 2962,2971 ****
  1363.   # define WL_SIGN    WL_FOLD        /* column for signs */
  1364.   #endif
  1365.   #define WL_NR        WL_SIGN + 1    /* line number */
  1366.   #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
  1367. ! # define WL_SBR        WL_NR + 1    /* 'showbreak' or 'diff' */
  1368.   #else
  1369. ! # define WL_SBR        WL_NR
  1370.   #endif
  1371.   #define WL_LINE        WL_SBR + 1    /* text in the line */
  1372.       int        draw_state = WL_START;    /* what to draw next */
  1373. --- 2962,2976 ----
  1374.   # define WL_SIGN    WL_FOLD        /* column for signs */
  1375.   #endif
  1376.   #define WL_NR        WL_SIGN + 1    /* line number */
  1377. + #ifdef FEAT_LINEBREAK
  1378. + # define WL_BRI        WL_NR + 1    /* 'breakindent' */
  1379. + #else
  1380. + # define WL_BRI        WL_NR
  1381. + #endif
  1382.   #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
  1383. ! # define WL_SBR        WL_BRI + 1    /* 'showbreak' or 'diff' */
  1384.   #else
  1385. ! # define WL_SBR        WL_BRI
  1386.   #endif
  1387.   #define WL_LINE        WL_SBR + 1    /* text in the line */
  1388.       int        draw_state = WL_START;    /* what to draw next */
  1389. ***************
  1390. *** 3301,3307 ****
  1391.   #endif
  1392.       while (vcol < v && *ptr != NUL)
  1393.       {
  1394. !         c = win_lbr_chartabsize(wp, ptr, (colnr_T)vcol, NULL);
  1395.           vcol += c;
  1396.   #ifdef FEAT_MBYTE
  1397.           prev_ptr = ptr;
  1398. --- 3306,3312 ----
  1399.   #endif
  1400.       while (vcol < v && *ptr != NUL)
  1401.       {
  1402. !         c = win_lbr_chartabsize(wp, line, ptr, (colnr_T)vcol, NULL);
  1403.           vcol += c;
  1404.   #ifdef FEAT_MBYTE
  1405.           prev_ptr = ptr;
  1406. ***************
  1407. *** 3670,3675 ****
  1408. --- 3675,3718 ----
  1409.           }
  1410.           }
  1411.   
  1412. + #ifdef FEAT_LINEBREAK
  1413. +         if (wp->w_p_brisbr && draw_state == WL_BRI - 1
  1414. +                          && n_extra == 0 && *p_sbr != NUL)
  1415. +         /* draw indent after showbreak value */
  1416. +         draw_state = WL_BRI;
  1417. +         else if (wp->w_p_brisbr && draw_state == WL_SBR && n_extra == 0)
  1418. +         /* After the showbreak, draw the breakindent */
  1419. +         draw_state = WL_BRI - 1;
  1420. +         /* draw 'breakindent': indent wrapped text accordingly */
  1421. +         if (draw_state == WL_BRI - 1 && n_extra == 0)
  1422. +         {
  1423. +         draw_state = WL_BRI;
  1424. + # ifdef FEAT_DIFF
  1425. + # endif
  1426. +         if (wp->w_p_bri && n_extra == 0 && row != startrow
  1427. + #ifdef FEAT_DIFF
  1428. +             && filler_lines == 0
  1429. + #endif
  1430. +            )
  1431. +         {
  1432. +             char_attr = 0; /* was: hl_attr(HLF_AT); */
  1433. + #ifdef FEAT_DIFF
  1434. +             if (diff_hlf != (hlf_T)0)
  1435. +             char_attr = hl_attr(diff_hlf);
  1436. + #endif
  1437. +             p_extra = NUL;
  1438. +             c_extra = ' ';
  1439. +             n_extra = get_breakindent_win(wp,
  1440. +                        ml_get_buf(wp->w_buffer, lnum, FALSE));
  1441. +             /* Correct end of highlighted area for 'breakindent',
  1442. +              * required when 'linebreak' is also set. */
  1443. +             if (tocol == vcol)
  1444. +             tocol += n_extra;
  1445. +         }
  1446. +         }
  1447. + #endif
  1448.   #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
  1449.           if (draw_state == WL_SBR - 1 && n_extra == 0)
  1450.           {
  1451. ***************
  1452. *** 4382,4392 ****
  1453.           if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)
  1454.                                    && !wp->w_p_list)
  1455.           {
  1456. !             n_extra = win_lbr_chartabsize(wp, ptr - (
  1457.   # ifdef FEAT_MBYTE
  1458.                   has_mbyte ? mb_l :
  1459.   # endif
  1460. !                 1), (colnr_T)vcol, NULL) - 1;
  1461.               c_extra = ' ';
  1462.               if (vim_iswhite(c))
  1463.               {
  1464. --- 4425,4438 ----
  1465.           if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)
  1466.                                    && !wp->w_p_list)
  1467.           {
  1468. !             char_u *p = ptr - (
  1469.   # ifdef FEAT_MBYTE
  1470.                   has_mbyte ? mb_l :
  1471.   # endif
  1472. !                 1);
  1473. !             /* TODO: is passing p for start of the line OK? */
  1474. !             n_extra = win_lbr_chartabsize(wp, p, p, (colnr_T)vcol,
  1475. !                                     NULL) - 1;
  1476.               c_extra = ' ';
  1477.               if (vim_iswhite(c))
  1478.               {
  1479. ***************
  1480. *** 8916,8923 ****
  1481.       {
  1482.           if (noinvcurs)
  1483.           screen_stop_highlight();
  1484. !         if (row == screen_cur_row && (col > screen_cur_col) &&
  1485. !                                 *T_CRI != NUL)
  1486.           term_cursor_right(col - screen_cur_col);
  1487.           else
  1488.           term_windgoto(row, col);
  1489. --- 8962,8969 ----
  1490.       {
  1491.           if (noinvcurs)
  1492.           screen_stop_highlight();
  1493. !         if (row == screen_cur_row && (col > screen_cur_col)
  1494. !                                  && *T_CRI != NUL)
  1495.           term_cursor_right(col - screen_cur_col);
  1496.           else
  1497.           term_windgoto(row, col);
  1498. *** ../vim-7.4.337/src/structs.h    2014-06-17 17:48:21.784628008 +0200
  1499. --- src/structs.h    2014-06-25 12:57:01.006115766 +0200
  1500. ***************
  1501. *** 134,139 ****
  1502. --- 134,145 ----
  1503.       int        wo_arab;
  1504.   # define w_p_arab w_onebuf_opt.wo_arab    /* 'arabic' */
  1505.   #endif
  1506. + #ifdef FEAT_LINEBREAK
  1507. +     int        wo_bri;
  1508. + # define w_p_bri w_onebuf_opt.wo_bri    /* 'breakindent' */
  1509. +     char_u        *wo_briopt;
  1510. + # define w_p_briopt w_onebuf_opt.wo_briopt /* 'breakindentopt' */
  1511. + #endif
  1512.   #ifdef FEAT_DIFF
  1513.       int        wo_diff;
  1514.   # define w_p_diff w_onebuf_opt.wo_diff    /* 'diff' */
  1515. ***************
  1516. *** 2189,2194 ****
  1517. --- 2195,2205 ----
  1518.   #ifdef FEAT_SYN_HL
  1519.       int        *w_p_cc_cols;        /* array of columns to highlight or NULL */
  1520.   #endif
  1521. + #ifdef FEAT_LINEBREAK
  1522. +     int        w_p_brimin;        /* minimum width for breakindent */
  1523. +     int        w_p_brishift;        /* additional shift for breakindent */
  1524. +     int        w_p_brisbr;        /* sbr in 'briopt' */
  1525. + #endif
  1526.   
  1527.       /* transform a pointer to a "onebuf" option into a "allbuf" option */
  1528.   #define GLOBAL_WO(p)    ((char *)p + sizeof(winopt_T))
  1529. *** ../vim-7.4.337/src/testdir/Make_amiga.mak    2014-05-29 11:47:19.804773758 +0200
  1530. --- src/testdir/Make_amiga.mak    2014-06-25 12:57:01.006115766 +0200
  1531. ***************
  1532. *** 37,42 ****
  1533. --- 37,43 ----
  1534.           test99.out test100.out test101.out test102.out test103.out \
  1535.           test104.out test105.out test106.out test107.out \
  1536.           test_autoformat_join.out \
  1537. +         test_breakindent.out \
  1538.           test_eval.out \
  1539.           test_options.out
  1540.   
  1541. ***************
  1542. *** 163,167 ****
  1543. --- 164,169 ----
  1544.   test106.out: test106.in
  1545.   test107.out: test107.in
  1546.   test_autoformat_join.out: test_autoformat_join.in
  1547. + test_breakindent.out: test_breakindent.in
  1548.   test_eval.out: test_eval.in
  1549.   test_options.out: test_options.in
  1550. *** ../vim-7.4.337/src/testdir/Make_dos.mak    2014-05-29 11:47:19.804773758 +0200
  1551. --- src/testdir/Make_dos.mak    2014-06-25 12:57:01.006115766 +0200
  1552. ***************
  1553. *** 36,41 ****
  1554. --- 36,42 ----
  1555.           test100.out test101.out test102.out test103.out test104.out \
  1556.           test105.out test106.out  test107.out\
  1557.           test_autoformat_join.out \
  1558. +         test_breakindent.out \
  1559.           test_eval.out \
  1560.           test_options.out
  1561.   
  1562. *** ../vim-7.4.337/src/testdir/Make_ming.mak    2014-05-29 11:47:19.804773758 +0200
  1563. --- src/testdir/Make_ming.mak    2014-06-25 12:57:01.006115766 +0200
  1564. ***************
  1565. *** 56,61 ****
  1566. --- 56,62 ----
  1567.           test100.out test101.out test102.out test103.out test104.out \
  1568.           test105.out test106.out test107.out \
  1569.           test_autoformat_join.out \
  1570. +         test_breakindent.out \
  1571.           test_eval.out \
  1572.           test_options.out
  1573.   
  1574. *** ../vim-7.4.337/src/testdir/Make_os2.mak    2014-05-29 11:47:19.804773758 +0200
  1575. --- src/testdir/Make_os2.mak    2014-06-25 12:59:45.774121999 +0200
  1576. ***************
  1577. *** 39,44 ****
  1578. --- 39,45 ----
  1579.           test105.out test106.out test107.out \
  1580.           test_autoformat_join.out \
  1581.           test_eval.out \
  1582. +         test_breakindent.out \
  1583.           test_options.out
  1584.   
  1585.   .SUFFIXES: .in .out
  1586. *** ../vim-7.4.337/src/testdir/Make_vms.mms    2014-05-29 11:47:19.804773758 +0200
  1587. --- src/testdir/Make_vms.mms    2014-06-25 12:57:01.006115766 +0200
  1588. ***************
  1589. *** 97,102 ****
  1590. --- 97,103 ----
  1591.        test100.out test101.out test103.out test104.out \
  1592.        test105.out test106.out test107.out \
  1593.        test_autoformat_join.out \
  1594. +      test_breakindent.out \
  1595.        test_eval.out \
  1596.        test_options.out
  1597.   
  1598. *** ../vim-7.4.337/src/testdir/Makefile    2014-05-29 11:47:19.804773758 +0200
  1599. --- src/testdir/Makefile    2014-06-25 12:57:01.006115766 +0200
  1600. ***************
  1601. *** 34,39 ****
  1602. --- 34,40 ----
  1603.           test99.out test100.out test101.out test102.out test103.out \
  1604.           test104.out test105.out test106.out test107.out \
  1605.           test_autoformat_join.out \
  1606. +         test_breakindent.out \
  1607.           test_eval.out \
  1608.           test_options.out
  1609.   
  1610. *** ../vim-7.4.337/src/testdir/test_breakindent.in    2014-06-25 14:36:28.690341532 +0200
  1611. --- src/testdir/test_breakindent.in    2014-06-25 14:26:00.994317785 +0200
  1612. ***************
  1613. *** 0 ****
  1614. --- 1,79 ----
  1615. + Test for breakindent
  1616. + STARTTEST
  1617. + :so small.vim
  1618. + :if !exists("+breakindent") | e! test.ok | w! test.out | qa! | endif
  1619. + :10new|:vsp|:vert resize 20
  1620. + :put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\"
  1621. + :set ts=4 sw=4 sts=4 breakindent
  1622. + :fu! ScreenChar(width)
  1623. + :    let c=''
  1624. + :    for i in range(1,a:width)
  1625. + :        let c.=nr2char(screenchar(line('.'), i))
  1626. + :    endfor
  1627. + :       let c.="\n"
  1628. + :    for i in range(1,a:width)
  1629. + :        let c.=nr2char(screenchar(line('.')+1, i))
  1630. + :    endfor
  1631. + :       let c.="\n"
  1632. + :    for i in range(1,a:width)
  1633. + :        let c.=nr2char(screenchar(line('.')+2, i))
  1634. + :    endfor
  1635. + :    return c
  1636. + :endfu
  1637. + :fu DoRecordScreen()
  1638. + :    wincmd l
  1639. + :    $put =printf(\"\n%s\", g:test)
  1640. + :    $put =g:line1
  1641. + :    wincmd p
  1642. + :endfu
  1643. + :let g:test="Test 1: Simple breakindent"
  1644. + :let line1=ScreenChar(8)
  1645. + :call DoRecordScreen()
  1646. + :let g:test="Test 2: Simple breakindent + sbr=>>"
  1647. + :set sbr=>>
  1648. + :let line1=ScreenChar(8)
  1649. + :call DoRecordScreen()
  1650. + :let g:test ="Test 3: Simple breakindent + briopt:sbr"
  1651. + :set briopt=sbr,min:0 sbr=++
  1652. + :let line1=ScreenChar(8)
  1653. + :call DoRecordScreen()
  1654. + :let g:test ="Test 4: Simple breakindent + min width: 18"
  1655. + :set sbr= briopt=min:18
  1656. + :let line1=ScreenChar(8)
  1657. + :call DoRecordScreen()
  1658. + :let g:test =" Test 5: Simple breakindent + shift by 2"
  1659. + :set briopt=shift:2,min:0
  1660. + :let line1=ScreenChar(8)
  1661. + :call DoRecordScreen()
  1662. + :let g:test=" Test 6: Simple breakindent + shift by -1"
  1663. + :set briopt=shift:-1,min:0
  1664. + :let line1=ScreenChar(8)
  1665. + :call DoRecordScreen()
  1666. + :let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr"
  1667. + :set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4
  1668. + :let line1=ScreenChar(10)
  1669. + :call DoRecordScreen()
  1670. + :let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr"
  1671. + :set briopt=shift:1,sbr,min:0 nu sbr=# list
  1672. + :let line1=ScreenChar(10)
  1673. + :call DoRecordScreen()
  1674. + :let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list"
  1675. + :set briopt-=sbr
  1676. + :let line1=ScreenChar(10)
  1677. + :call DoRecordScreen()
  1678. + :let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n"
  1679. + :set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0
  1680. + :let line1=ScreenChar(10)
  1681. + :call DoRecordScreen()
  1682. + :wincmd p
  1683. + :let g:test="\n Test 11: strdisplaywidth when breakindent is on"
  1684. + :set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4
  1685. + :let text=getline(2) "skip leading tab when calculating text width
  1686. + :let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times
  1687. + :$put =g:test
  1688. + :$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)
  1689. + :%w! test.out
  1690. + :qa!
  1691. + ENDTEST
  1692. + dummy text
  1693. *** ../vim-7.4.337/src/testdir/test_breakindent.ok    2014-06-25 14:36:28.698341532 +0200
  1694. --- src/testdir/test_breakindent.ok    2014-06-25 12:57:01.006115766 +0200
  1695. ***************
  1696. *** 0 ****
  1697. --- 1,55 ----
  1698. +     abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP
  1699. + Test 1: Simple breakindent
  1700. +     abcd
  1701. +     qrst
  1702. +     GHIJ
  1703. + Test 2: Simple breakindent + sbr=>>
  1704. +     abcd
  1705. +     >>qr
  1706. +     >>EF
  1707. + Test 3: Simple breakindent + briopt:sbr
  1708. +     abcd
  1709. + ++  qrst
  1710. + ++  GHIJ
  1711. + Test 4: Simple breakindent + min width: 18
  1712. +     abcd
  1713. +   qrstuv
  1714. +   IJKLMN
  1715. +  Test 5: Simple breakindent + shift by 2
  1716. +     abcd
  1717. +       qr
  1718. +       EF
  1719. +  Test 6: Simple breakindent + shift by -1
  1720. +     abcd
  1721. +    qrstu
  1722. +    HIJKL
  1723. +  Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr
  1724. +   2     ab
  1725. + ?        m
  1726. + ?        x
  1727. +  Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr
  1728. +   2 ^Iabcd
  1729. + #      opq
  1730. + #      BCD
  1731. +  Test 9: breakindent + shift by +1 + 'nu' + sbr=# list
  1732. +   2 ^Iabcd
  1733. +        #op
  1734. +        #AB
  1735. +  Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n
  1736. +   2     ab
  1737. + ~       mn
  1738. + ~       yz
  1739. +  Test 11: strdisplaywidth when breakindent is on
  1740. + strdisplaywidth: 46 == calculated: 64
  1741. *** ../vim-7.4.337/src/ui.c    2014-06-12 13:28:26.771694851 +0200
  1742. --- src/ui.c    2014-06-25 13:22:20.218173240 +0200
  1743. ***************
  1744. *** 3162,3176 ****
  1745.       /* try to advance to the specified column */
  1746.       int        count = 0;
  1747.       char_u    *ptr;
  1748. !     char_u    *start;
  1749.   
  1750. !     start = ptr = ml_get_buf(wp->w_buffer, lnum, FALSE);
  1751.       while (count < vcol && *ptr != NUL)
  1752.       {
  1753. !     count += win_lbr_chartabsize(wp, ptr, count, NULL);
  1754.       mb_ptr_adv(ptr);
  1755.       }
  1756. !     return (int)(ptr - start);
  1757.   }
  1758.   #endif
  1759.   
  1760. --- 3162,3176 ----
  1761.       /* try to advance to the specified column */
  1762.       int        count = 0;
  1763.       char_u    *ptr;
  1764. !     char_u    *line;
  1765.   
  1766. !     line = ptr = ml_get_buf(wp->w_buffer, lnum, FALSE);
  1767.       while (count < vcol && *ptr != NUL)
  1768.       {
  1769. !     count += win_lbr_chartabsize(wp, line, ptr, count, NULL);
  1770.       mb_ptr_adv(ptr);
  1771.       }
  1772. !     return (int)(ptr - line);
  1773.   }
  1774.   #endif
  1775.   
  1776. *** ../vim-7.4.337/src/version.c    2014-06-25 12:26:42.230046959 +0200
  1777. --- src/version.c    2014-06-25 13:00:26.990123558 +0200
  1778. ***************
  1779. *** 736,737 ****
  1780. --- 736,739 ----
  1781.   {   /* Add new patch number below this line */
  1782. + /**/
  1783. +     338,
  1784.   /**/
  1785.  
  1786. -- 
  1787. MORTICIAN:    Bring out your dead!
  1788.               [clang]
  1789.               Bring out your dead!
  1790.               [clang]
  1791.               Bring out your dead!
  1792. CUSTOMER:     Here's one -- nine pence.
  1793. DEAD PERSON:  I'm not dead!
  1794.                                   The Quest for the Holy Grail (Monty Python)
  1795.  
  1796.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  1797. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  1798. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  1799.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  1800.