Patch 8.2.2524
Problem:    Cannot change the characters displayed in the foldcolumn.
Solution:   Add fields to 'fillchars'. (Yegappan Lakshmanan, Matthieu Coudron,
            closes #7860)
Files:      runtime/doc/options.txt, src/globals.h, src/mouse.c, src/screen.c,
            src/testdir/test_display.vim


*** ../vim-8.2.2523/runtime/doc/options.txt     2021-02-15 20:37:58.453374547 
+0100
--- runtime/doc/options.txt     2021-02-17 13:02:49.733623294 +0100
***************
*** 3243,3248 ****
--- 3247,3255 ----
          stlnc:c       ' ' or '='      statusline of the non-current windows
          vert:c        '|'             vertical separators |:vsplit|
          fold:c        '-'             filling 'foldtext'
+         foldopen:c    '-'             mark the beginning of a fold
+         foldclose:c   '+'             show a closed fold
+         foldsep:c     '|'             open fold middle character
          diff:c        '-'             deleted lines of the 'diff' option
          eob:c         '~'             empty lines below the end of a buffer
  
*** ../vim-8.2.2523/src/globals.h       2021-02-15 20:37:58.457374538 +0100
--- src/globals.h       2021-02-17 13:02:49.733623294 +0100
***************
*** 1347,1352 ****
--- 1347,1355 ----
  EXTERN int    fill_stlnc INIT(= ' ');
  EXTERN int    fill_vert INIT(= ' ');
  EXTERN int    fill_fold INIT(= '-');
+ EXTERN int    fill_foldopen INIT(= '-');
+ EXTERN int    fill_foldclosed INIT(= '+');
+ EXTERN int    fill_foldsep INIT(= '|');
  EXTERN int    fill_diff INIT(= '-');
  EXTERN int    fill_eob INIT(= '~');
  
*** ../vim-8.2.2523/src/mouse.c 2020-11-02 20:03:51.615794746 +0100
--- src/mouse.c 2021-02-17 13:02:49.733623294 +0100
***************
*** 1989,1995 ****
        count |= CURSOR_MOVED;          // Cursor has moved
  
  # ifdef FEAT_FOLDING
!     if (mouse_char == '+')
        count |= MOUSE_FOLD_OPEN;
      else if (mouse_char != ' ')
        count |= MOUSE_FOLD_CLOSE;
--- 1989,1995 ----
        count |= CURSOR_MOVED;          // Cursor has moved
  
  # ifdef FEAT_FOLDING
!     if (mouse_char == fill_foldclosed)
        count |= MOUSE_FOLD_OPEN;
      else if (mouse_char != ' ')
        count |= MOUSE_FOLD_CLOSE;
*** ../vim-8.2.2523/src/screen.c        2021-02-16 22:22:08.115777605 +0100
--- src/screen.c        2021-02-17 13:02:49.733623294 +0100
***************
*** 272,280 ****
        {
            if (win_foldinfo.fi_lnum == lnum
                              && first_level + i >= win_foldinfo.fi_low_level)
!               p[i] = '-';
            else if (first_level == 1)
!               p[i] = '|';
            else if (first_level + i <= 9)
                p[i] = '0' + first_level + i;
            else
--- 272,280 ----
        {
            if (win_foldinfo.fi_lnum == lnum
                              && first_level + i >= win_foldinfo.fi_low_level)
!               p[i] = fill_foldopen;
            else if (first_level == 1)
!               p[i] = fill_foldsep;
            else if (first_level + i <= 9)
                p[i] = '0' + first_level + i;
            else
***************
*** 284,290 ****
        }
      }
      if (closed)
!       p[i >= fdc ? i - 1 : i] = '+';
  }
  #endif // FEAT_FOLDING
  
--- 284,290 ----
        }
      }
      if (closed)
!       p[i >= fdc ? i - 1 : i] = fill_foldclosed;
  }
  #endif // FEAT_FOLDING
  
***************
*** 4761,4772 ****
      };
      static struct charstab filltab[] =
      {
!       {&fill_stl,     "stl"},
!       {&fill_stlnc,   "stlnc"},
!       {&fill_vert,    "vert"},
!       {&fill_fold,    "fold"},
!       {&fill_diff,    "diff"},
!       {&fill_eob,     "eob"},
      };
      static lcs_chars_T lcs_chars;
      struct charstab lcstab[] =
--- 4761,4775 ----
      };
      static struct charstab filltab[] =
      {
!       {&fill_stl,             "stl"},
!       {&fill_stlnc,           "stlnc"},
!       {&fill_vert,            "vert"},
!       {&fill_fold,            "fold"},
!       {&fill_foldopen,        "foldopen"},
!       {&fill_foldclosed,      "foldclose"},
!       {&fill_foldsep,         "foldsep"},
!       {&fill_diff,            "diff"},
!       {&fill_eob,             "eob"},
      };
      static lcs_chars_T lcs_chars;
      struct charstab lcstab[] =
***************
*** 4821,4826 ****
--- 4824,4832 ----
            else
            {
                fill_diff = '-';
+               fill_foldopen = '-';
+               fill_foldclosed = '+';
+               fill_foldsep = '|';
                fill_eob = '~';
            }
        }
*** ../vim-8.2.2523/src/testdir/test_display.vim        2021-02-13 
18:24:19.326118995 +0100
--- src/testdir/test_display.vim        2021-02-17 13:02:49.733623294 +0100
***************
*** 279,282 ****
--- 279,336 ----
    close
  endfunc
  
+ " Test for 'foldopen', 'foldclose' and 'foldsep' in 'fillchars'
+ func Test_fold_fillchars()
+   new
+   set fdc=2 foldenable foldmethod=manual
+   call setline(1, ['one', 'two', 'three', 'four', 'five'])
+   2,4fold
+   " First check for the default setting for a closed fold
+   let lines = ScreenLines([1, 3], 8)
+   let expected = [
+         \ '  one   ',
+         \ '+ +--  3',
+         \ '  five  '
+         \ ]
+   call assert_equal(expected, lines)
+   normal 2Gzo
+   " check the characters for an open fold
+   let lines = ScreenLines([1, 5], 8)
+   let expected = [
+         \ '  one   ',
+         \ '- two   ',
+         \ '| three ',
+         \ '| four  ',
+         \ '  five  '
+         \ ]
+   call assert_equal(expected, lines)
+ 
+   " change the setting
+   set fillchars=vert:\|,fold:-,eob:~,foldopen:[,foldclose:],foldsep:-
+ 
+   " check the characters for an open fold
+   let lines = ScreenLines([1, 5], 8)
+   let expected = [
+         \ '  one   ',
+         \ '[ two   ',
+         \ '- three ',
+         \ '- four  ',
+         \ '  five  '
+         \ ]
+   call assert_equal(expected, lines)
+ 
+   " check the characters for a closed fold
+   normal 2Gzc
+   let lines = ScreenLines([1, 3], 8)
+   let expected = [
+         \ '  one   ',
+         \ '] +--  3',
+         \ '  five  '
+         \ ]
+   call assert_equal(expected, lines)
+ 
+   %bw!
+   set fillchars& fdc& foldmethod& foldenable&
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2523/src/version.c       2021-02-17 12:29:12.218657041 +0100
--- src/version.c       2021-02-17 13:04:53.465335180 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2524,
  /**/

-- 
CRONE:  Who sent you?
ARTHUR: The Knights Who Say Ni!
CRONE:  Aaaagh!  (she looks around in rear) No!  We have no shrubberies here.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202102171214.11HCEljY2172745%40masaka.moolenaar.net.

Raspunde prin e-mail lui