Hi guys, I'm trying to add new options to allow users tweak their fold columns. 
The first option is:

    'foldcolshowlvl'  'fsl':    Show a number representing the fold level.

This allow user to "hide" the numbers representing the fold level. It is very 
useful is the `foldcolumn` is 1.

My second option is the definition of custom characters to use while drawing 
the fold column. This way users can have characters representing folders other 
than `+`, `-` and `|`.

So far I could make this works very well with one exception: multi-bytes.

If I define the new characters to be like this:

    set fds=fa:\ ,fo:▾,fc:▸

Nothing is shown on the fold column. I notice that on `screen.c` we have a 
function called `fill_foldcolumn` where those characters are defined, and there 
is where I tried to use the new characts, but since it has code like this:

                p[i] = fds_fo;
    
This means that since `p` is a `char_u`, anything that is hold after the first 
8 bits will be truncated. I tried to force the copy of the rest of the bits but 
had no luck on that!

Any one have a clue about this?

-- 
-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.


>From 149e8995ea9eedc2fda9615a291512fcb4385d0a Mon Sep 17 00:00:00 2001
From: Thiago Alves <[email protected]>
Date: Wed, 13 Feb 2013 23:22:08 -0600
Subject: [PATCH] Added optino to hide/show level # on fold column.

The new option 'foldcolshowlvl' ('fsl' for short), allow one to hide the
numbers vim show on the fold column to indicate the fold level. This can
help use foldcolumn equals one and don't have a crowded fold column.
---
 runtime/doc/fold.txt    | 21 +++++++++++----------
 runtime/doc/options.txt | 10 ++++++++++
 src/option.c            |  6 ++++++
 src/option.h            |  1 +
 src/screen.c            | 12 ++++++------
 src/structs.h           |  2 ++
 6 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt
index 4f27933..9cb40bd 100644
--- a/runtime/doc/fold.txt
+++ b/runtime/doc/fold.txt
@@ -540,16 +540,17 @@ fold column:
 
 OTHER OPTIONS
 
-'foldenable'  'fen':	Open all folds while not set.
-'foldexpr'    'fde':	Expression used for "expr" folding.
-'foldignore'  'fdi':	Characters used for "indent" folding.
-'foldmarker'  'fmr':	Defined markers used for "marker" folding.
-'foldmethod'  'fdm':	Name of the current folding method.
-'foldminlines' 'fml':	Minimum number of screen lines for a fold to be
-			displayed closed.
-'foldnestmax' 'fdn':	Maximum nesting for "indent" and "syntax" folding.
-'foldopen'    'fdo':	Which kinds of commands open closed folds.
-'foldclose'   'fcl':	When the folds not under the cursor are closed.
+'foldcolshowlvl'  'fsl':	Show a number representing the fold level.
+'foldenable'      'fen':	Open all folds while not set.
+'foldexpr'        'fde':	Expression used for "expr" folding.
+'foldignore'      'fdi':	Characters used for "indent" folding.
+'foldmarker'      'fmr':	Defined markers used for "marker" folding.
+'foldmethod'      'fdm':	Name of the current folding method.
+'foldminlines'    'fml':	Minimum number of screen lines for a fold to be
+				displayed closed.
+'foldnestmax'     'fdn':	Maximum nesting for "indent" and "syntax" folding.
+'foldopen'        'fdo':	Which kinds of commands open closed folds.
+'foldclose'       'fcl':	When the folds not under the cursor are closed.
 
 ==============================================================================
 4. Behavior of folds					*fold-behavior*
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 267a630..66bd2e8 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -3033,6 +3033,16 @@ A jump table for the options with a short description can be found at |Q_op|.
 	value is 12.
 	See |folding|.
 
+						*'foldcolshowlvl'* *'fsl'*
+'foldcolshowlvl' 'fsl'	boolean (default on)
+			local to window
+			{not in Vi}
+			{not available when compiled without the |+folding|
+			feature}
+        When off, the fold column will not show the number representing the
+        fold level when your |foldcolumn| option is set to a value lower than
+        the amount of fold levels.
+
 			*'foldenable'* *'fen'* *'nofoldenable'* *'nofen'*
 'foldenable' 'fen'	boolean (default on)
 			local to window
diff --git a/src/option.c b/src/option.c
index f5d1b4a..9e7c58b 100644
--- a/src/option.c
+++ b/src/option.c
@@ -194,6 +194,7 @@
 # define PV_DIFF	OPT_WIN(WV_DIFF)
 #endif
 #ifdef FEAT_FOLDING
+# define PV_FSL		OPT_WIN(WV_FSL)
 # define PV_FDC		OPT_WIN(WV_FDC)
 # define PV_FEN		OPT_WIN(WV_FEN)
 # define PV_FDI		OPT_WIN(WV_FDI)
@@ -1149,6 +1150,9 @@ static struct vimoption
     {"foldclose",   "fcl",  P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_RWIN,
 			    (char_u *)&p_fcl, PV_NONE,
 			    {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
+    {"foldcolshowlvl","fsl",P_BOOL|P_VI_DEF|P_RWIN,
+			    (char_u *)VAR_WIN, PV_FSL,
+			    {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
     {"foldcolumn",  "fdc",  P_NUM|P_VI_DEF|P_RWIN,
 			    (char_u *)VAR_WIN, PV_FDC,
 			    {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
@@ -9795,6 +9799,7 @@ get_varp(p)
 #endif
 #ifdef FEAT_FOLDING
 	case PV_FDC:	return (char_u *)&(curwin->w_p_fdc);
+	case PV_FSL:	return (char_u *)&(curwin->w_p_fsl);
 	case PV_FEN:	return (char_u *)&(curwin->w_p_fen);
 	case PV_FDI:	return (char_u *)&(curwin->w_p_fdi);
 	case PV_FDL:	return (char_u *)&(curwin->w_p_fdl);
@@ -10041,6 +10046,7 @@ copy_winopt(from, to)
     to->wo_cole = from->wo_cole;
 #endif
 #ifdef FEAT_FOLDING
+    to->wo_fsl = from->wo_fsl;
     to->wo_fdc = from->wo_fdc;
     to->wo_fen = from->wo_fen;
     to->wo_fdi = vim_strsave(from->wo_fdi);
diff --git a/src/option.h b/src/option.h
index 8ffdb25..0e61982 100644
--- a/src/option.h
+++ b/src/option.h
@@ -1072,6 +1072,7 @@ enum
 #endif
 #ifdef FEAT_FOLDING
     , WV_FDC
+    , WV_FSL
     , WV_FEN
     , WV_FDI
     , WV_FDL
diff --git a/src/screen.c b/src/screen.c
index 478cb71..ef4b913 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2659,12 +2659,12 @@ fill_foldcolumn(p, wp, closed, lnum)
 	    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
-		p[i] = '>';
+            else if (first_level == 1 || !wp->w_p_fsl)
+                p[i] = '|';
+            else if (first_level + i <= 9)
+                p[i] = '0' + first_level + i;
+            else
+                p[i] = '>';
 	    if (first_level + i == level)
 		break;
 	}
diff --git a/src/structs.h b/src/structs.h
index 2ce40cf..f638464 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -140,6 +140,8 @@ typedef struct
 #ifdef FEAT_FOLDING
     long	wo_fdc;
 # define w_p_fdc w_onebuf_opt.wo_fdc	/* 'foldcolumn' */
+    int		wo_fsl;
+# define w_p_fsl w_onebuf_opt.wo_fsl	/* 'foldcolshowlvl' */
     int		wo_fen;
 # define w_p_fen w_onebuf_opt.wo_fen	/* 'foldenable' */
     char_u	*wo_fdi;
-- 
1.7.12.4 (Apple Git-37)

Raspunde prin e-mail lui