Hi all,
I finally found the mistake in the patch sent yesterday - so now it
works pretty nice (at least here on my machine). You are now free to
give it a try.
BTW, I am new to mercurial - is there an easy way to convert the hg
diff into the vim desired 'diff -c' format? I had some trouble to do that.
Best regards,
Gregor
diff -rcN vim.2bd96108392e/runtime/doc/options.txt vim/runtime/doc/options.txt
*** vim.2bd96108392e/runtime/doc/options.txt 2010-02-02 18:24:17.000000000
+0100
--- vim/runtime/doc/options.txt 2010-02-02 18:24:17.000000000 +0100
***************
*** 4475,4480 ****
--- 4475,4495 ----
< This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
+ *'margincolumn'* *'mc'*
+ 'margincolumn' 'mc' number (default 0)
+ local to window
+ {not in Vi}
+ {not available when compiled without the |+syntax|
+ feature}
+ Highlight a particular screen column with MarginColumn
+ |hl-MarginColumn|. Useful to align text. Will make screen redrawing
+ slower.
+ If 'margincolumn' < 0 then 'margincolumn' is set equal to 'textwidth'.
+ If you only want the highlighting in the current window you can use
+ these autocommands: >
+ au WinLeave * set mc=0
+ au WinEnter * set mc=81
+
*'matchpairs'* *'mps'*
'matchpairs' 'mps' string (default "(:),{:},[:]")
local to buffer
diff -rcN vim.2bd96108392e/src/option.c vim/src/option.c
*** vim.2bd96108392e/src/option.c 2010-02-02 18:24:17.000000000 +0100
--- vim/src/option.c 2010-02-02 18:24:17.000000000 +0100
***************
*** 227,232 ****
--- 227,233 ----
#ifdef FEAT_SYN_HL
# define PV_CUC OPT_WIN(WV_CUC)
# define PV_CUL OPT_WIN(WV_CUL)
+ # define PV_MC OPT_WIN(WV_MC)
#endif
#ifdef FEAT_STL_OPT
# define PV_STL OPT_BOTH(OPT_WIN(WV_STL))
***************
*** 450,456 ****
#if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \
|| defined(FEAT_VERTSPLIT) || defined(FEAT_CLIPBOARD) \
|| defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL)
! # define HIGHLIGHT_INIT
"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine"
#else
# define HIGHLIGHT_INIT
"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill"
#endif
--- 451,457 ----
#if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \
|| defined(FEAT_VERTSPLIT) || defined(FEAT_CLIPBOARD) \
|| defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL)
! # define HIGHLIGHT_INIT
"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,g:MarginColumn"
#else
# define HIGHLIGHT_INIT
"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill"
#endif
***************
*** 1677,1682 ****
--- 1678,1690 ----
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
+ {"margincolumn", "mc", P_NUM|P_VI_DEF|P_RWIN,
+ #ifdef FEAT_SYN_HL
+ (char_u *)VAR_WIN, PV_MC,
+ #else
+ (char_u *)NULL, PV_NONE,
+ #endif
+ {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
{"matchpairs", "mps", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP,
(char_u *)&p_mps, PV_MPS,
{(char_u *)"(:),{:},[:]", (char_u *)0L}
***************
*** 2485,2491 ****
(char_u *)FALSE,
#endif
(char_u *)0L} SCRIPTID_INIT},
! {"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM,
(char_u *)&p_tw, PV_TW,
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
{"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
--- 2493,2499 ----
(char_u *)FALSE,
#endif
(char_u *)0L} SCRIPTID_INIT},
! {"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM|P_RWIN,
(char_u *)&p_tw, PV_TW,
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
{"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
***************
*** 9182,9187 ****
--- 9190,9196 ----
#ifdef FEAT_SYN_HL
case PV_CUC: return (char_u *)&(curwin->w_p_cuc);
case PV_CUL: return (char_u *)&(curwin->w_p_cul);
+ case PV_MC: return (char_u *)&(curwin->w_p_mc);
#endif
#ifdef FEAT_DIFF
case PV_DIFF: return (char_u *)&(curwin->w_p_diff);
***************
*** 9409,9414 ****
--- 9418,9424 ----
#ifdef FEAT_SYN_HL
to->wo_cuc = from->wo_cuc;
to->wo_cul = from->wo_cul;
+ to->wo_mc = from->wo_mc;
#endif
#ifdef FEAT_DIFF
to->wo_diff = from->wo_diff;
diff -rcN vim.2bd96108392e/src/option.h vim/src/option.h
*** vim.2bd96108392e/src/option.h 2010-02-02 18:24:17.000000000 +0100
--- vim/src/option.h 2010-02-02 18:24:17.000000000 +0100
***************
*** 1059,1064 ****
--- 1059,1065 ----
#ifdef FEAT_SYN_HL
, WV_CUC
, WV_CUL
+ , WV_MC
#endif
#ifdef FEAT_STL_OPT
, WV_STL
diff -rcN vim.2bd96108392e/src/screen.c vim/src/screen.c
*** vim.2bd96108392e/src/screen.c 2010-02-02 18:24:17.000000000 +0100
--- vim/src/screen.c 2010-02-02 18:24:17.000000000 +0100
***************
*** 2622,2627 ****
--- 2622,2630 ----
int has_syntax = FALSE; /* this buffer has syntax
highl. */
int save_did_emsg;
int eol_hl_off = 0; /* 1 if highlighted char after
EOL */
+ int margin_vcol = 0; /* ('margincolumn'-1) (= 0
based col)*/
+ int draw_margin_col = 0; /* Only highlight margincolumn
if 1*/
+ int rightmost_vcol; /* rightmost vcol that needs to
draw */
#endif
#ifdef FEAT_SPELL
int has_spell = FALSE; /* this buffer has spell
checking */
***************
*** 4497,4502 ****
--- 4500,4522 ----
if (c == NUL)
{
#ifdef FEAT_SYN_HL
+ if (wp->w_p_mc > 0)
+ {
+ margin_vcol = wp->w_p_mc - 1;
+ draw_margin_col = 1;
+ }
+ else if (wp->w_p_mc < 0
+ && curbuf->b_p_tw > 0)
+ {
+ margin_vcol = curbuf->b_p_tw;
+ draw_margin_col = 1;
+ }
+ else
+ {
+ margin_vcol = -1;
+ draw_margin_col = 0;
+ }
+
if (eol_hl_off > 0 && vcol - eol_hl_off == (long)wp->w_virtcol
&& lnum == wp->w_cursor.lnum)
{
***************
*** 4506,4530 ****
--vcol;
}
! /* Highlight 'cursorcolumn' past end of the line. */
if (wp->w_p_wrap)
v = wp->w_skipcol;
else
v = wp->w_leftcol;
/* check if line ends before left margin */
if (vcol < v + col - win_col_off(wp))
-
vcol = v + col - win_col_off(wp);
! if (wp->w_p_cuc
&& (int)wp->w_virtcol >= vcol - eol_hl_off
&& (int)wp->w_virtcol < W_WIDTH(wp) * (row - startrow + 1)
+ v
! && lnum != wp->w_cursor.lnum
# ifdef FEAT_RIGHTLEFT
&& !wp->w_p_rl
# endif
)
{
while (col < W_WIDTH(wp))
{
ScreenLines[off] = ' ';
--- 4526,4558 ----
--vcol;
}
! /* Highlight 'cursorcolumn' & 'margincolumn' past end of the line */
if (wp->w_p_wrap)
v = wp->w_skipcol;
else
v = wp->w_leftcol;
+
/* check if line ends before left margin */
if (vcol < v + col - win_col_off(wp))
vcol = v + col - win_col_off(wp);
!
! if (((wp->w_p_cuc
&& (int)wp->w_virtcol >= vcol - eol_hl_off
&& (int)wp->w_virtcol < W_WIDTH(wp) * (row - startrow + 1)
+ v
! && lnum != wp->w_cursor.lnum)
! || (draw_margin_col
! && margin_vcol >= vcol - eol_hl_off
! && margin_vcol < W_WIDTH(wp) * (row - startrow + 1)
! + v))
# ifdef FEAT_RIGHTLEFT
&& !wp->w_p_rl
# endif
)
{
+ rightmost_vcol = (margin_vcol > (long)wp->w_virtcol) ?
+ margin_vcol : wp->w_virtcol;
+
while (col < W_WIDTH(wp))
{
ScreenLines[off] = ' ';
***************
*** 4533,4544 ****
ScreenLinesUC[off] = 0;
#endif
++col;
! if (vcol == (long)wp->w_virtcol)
{
! ScreenAttrs[off] = hl_attr(HLF_CUC);
! break;
}
! ScreenAttrs[off++] = 0;
++vcol;
}
}
--- 4561,4582 ----
ScreenLinesUC[off] = 0;
#endif
++col;
! if (wp->w_p_cuc && vcol == (long)wp->w_virtcol)
{
! ScreenAttrs[off++] = hl_attr(HLF_CUC);
! }
! else if (draw_margin_col && vcol == margin_vcol)
! {
! ScreenAttrs[off++] = hl_attr(HLF_MC);
! }
! else
! {
! ScreenAttrs[off++] = 0;
}
!
! if (vcol >= rightmost_vcol)
! break;
!
++vcol;
}
}
***************
*** 4596,4603 ****
}
#ifdef FEAT_SYN_HL
/* Highlight the cursor column if 'cursorcolumn' is set. But don't
! * highlight the cursor position itself. */
if (wp->w_p_cuc && vcol == (long)wp->w_virtcol
&& lnum != wp->w_cursor.lnum
&& draw_state == WL_LINE
--- 4634,4660 ----
}
#ifdef FEAT_SYN_HL
+ if (wp->w_p_mc > 0)
+ {
+ margin_vcol = wp->w_p_mc - 1;
+ draw_margin_col = 1;
+ }
+ else if (wp->w_p_mc < 0
+ && curbuf->b_p_tw > 0)
+ {
+ margin_vcol = curbuf->b_p_tw;
+ draw_margin_col = 1;
+ }
+ else
+ {
+ draw_margin_col = 0;
+ }
+
+ vcol_save_attr = -1;
/* Highlight the cursor column if 'cursorcolumn' is set. But don't
! * highlight the cursor position itself.
! * Also highlight the 'margincolumn' if it is different than
! * 'cursorcolumn' */
if (wp->w_p_cuc && vcol == (long)wp->w_virtcol
&& lnum != wp->w_cursor.lnum
&& draw_state == WL_LINE
***************
*** 4606,4613 ****
vcol_save_attr = char_attr;
char_attr = hl_combine_attr(char_attr, hl_attr(HLF_CUC));
}
! else
! vcol_save_attr = -1;
#endif
/*
--- 4663,4675 ----
vcol_save_attr = char_attr;
char_attr = hl_combine_attr(char_attr, hl_attr(HLF_CUC));
}
! else if (draw_margin_col && vcol == margin_vcol
! && draw_state == WL_LINE
! && !lnum_in_visual_area)
! {
! vcol_save_attr = char_attr;
! char_attr = hl_combine_attr(char_attr, hl_attr(HLF_MC));
! }
#endif
/*
diff -rcN vim.2bd96108392e/src/structs.h vim/src/structs.h
*** vim.2bd96108392e/src/structs.h 2010-02-02 18:24:17.000000000 +0100
--- vim/src/structs.h 2010-02-02 18:24:17.000000000 +0100
***************
*** 200,205 ****
--- 200,207 ----
# define w_p_cuc w_onebuf_opt.wo_cuc /* 'cursorcolumn' */
int wo_cul;
# define w_p_cul w_onebuf_opt.wo_cul /* 'cursorline' */
+ long wo_mc;
+ # define w_p_mc w_onebuf_opt.wo_mc /* 'margincolumn' */
#endif
#ifdef FEAT_STL_OPT
char_u *wo_stl;
diff -rcN vim.2bd96108392e/src/syntax.c vim/src/syntax.c
*** vim.2bd96108392e/src/syntax.c 2010-02-02 18:24:17.000000000 +0100
--- vim/src/syntax.c 2010-02-02 18:24:17.000000000 +0100
***************
*** 6311,6316 ****
--- 6311,6318 ----
"CursorColumn term=reverse ctermbg=LightGrey guibg=Grey90"),
CENT("CursorLine term=underline cterm=underline",
"CursorLine term=underline cterm=underline guibg=Grey90"),
+ CENT("MarginColumn term=reverse ctermbg=Red",
+ "MarginColumn term=reverse ctermbg=Red guibg=Red"),
#endif
#ifdef FEAT_AUTOCMD
CENT("MatchParen term=reverse ctermbg=Cyan",
***************
*** 6391,6396 ****
--- 6393,6400 ----
"CursorColumn term=reverse ctermbg=DarkGrey guibg=Grey40"),
CENT("CursorLine term=underline cterm=underline",
"CursorLine term=underline cterm=underline guibg=Grey40"),
+ CENT("MarginColumn term=reverse ctermbg=DarkRed",
+ "MarginColumn term=reverse ctermbg=DarkRed guibg=DarkRed"),
#endif
#ifdef FEAT_AUTOCMD
CENT("MatchParen term=reverse ctermbg=DarkCyan",
diff -rcN vim.2bd96108392e/src/vim.h vim/src/vim.h
*** vim.2bd96108392e/src/vim.h 2010-02-02 18:24:17.000000000 +0100
--- vim/src/vim.h 2010-02-02 18:24:17.000000000 +0100
***************
*** 1255,1260 ****
--- 1255,1261 ----
, HLF_TPF /* tabpage line filler */
, HLF_CUC /* 'cursurcolumn' */
, HLF_CUL /* 'cursurline' */
+ , HLF_MC /* 'margincolumn' */
, HLF_COUNT /* MUST be the last one */
} hlf_T;
***************
*** 1264,1270 ****
'n', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
'f', 'F', 'A', 'C', 'D', 'T', '>', \
'B', 'P', 'R', 'L', \
! '+', '=', 'x', 'X', '*', '#', '_', '!', '.'}
/*
* Boolean constants
--- 1265,1271 ----
'n', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
'f', 'F', 'A', 'C', 'D', 'T', '>', \
'B', 'P', 'R', 'L', \
! '+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'g'}
/*
* Boolean constants
--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php