Sorry, there was a bug in my previous patch that shouldn't have slipped
my eyes, I forgot to add 'break;' in a switch structure... It's fixed
now.
--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
*** runtime/doc/indent.txt 2010-02-15 16:09:45.980505930 +0100
--- ../../vim7/runtime/doc/indent.txt 2010-02-15 14:57:34.001429987 +0100
***************
*** 216,221 ****
--- 216,236 ----
} } }
} } }
<
+ JN Controls placement of jump labels. If N equals -1, the label will
+ be placed at column 1. If N is non-negative, the indent of the
+ label will be that of a normal statement minus N. All other values
+ for N are invalid and the default value will be used instead.
+ (default -1).
+
+ cino= cino=L2 cino=Ls >
+ func() func() func()
+ { { {
+ { { {
+ stmt; stmt; stmt;
+ LABEL: LABEL: LABEL:
+ } } }
+ } } }
+ <
:N Place case labels N characters from the indent of the switch().
(default 'shiftwidth').
***************
*** 446,458 ****
The defaults, spelled out in full, are:
! cinoptions=>s,e0,n0,f0,{0,}0,^0,:s,=s,l0,b0,gs,hs,ps,ts,is,+s,c3,C0,
/0,(2s,us,U0,w0,W0,m0,j0,)20,*30,#0
Vim puts a line in column 1 if:
- It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'.
- It starts with a label (a keyword followed by ':', other than "case" and
! "default").
- Any combination of indentations causes the line to have less than 0
indentation.
--- 461,474 ----
The defaults, spelled out in full, are:
! cinoptions=>s,e0,n0,f0,{0,}0,^0,J-1,:s,=s,l0,b0,gs,hs,ps,ts,is,+s,c3,C0,
/0,(2s,us,U0,w0,W0,m0,j0,)20,*30,#0
Vim puts a line in column 1 if:
- It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'.
- It starts with a label (a keyword followed by ':', other than "case" and
! "default"), if 'cinoptions' does not contain JN for a non-negative value
! of N.
- Any combination of indentations causes the line to have less than 0
indentation.
*** src/misc1.c 2010-02-15 16:10:12.127169873 +0100
--- ../../vim7/src/misc1.c 2010-02-19 12:33:19.239414767 +0100
***************
*** 6035,6040 ****
--- 6035,6046 ----
int ind_open_left_imag = 0;
/*
+ * spaces jump labels should be shifted to the left if N is non-negative,
+ * otherwise the jump label will be put to column 1.
+ */
+ int ind_jump_label = -1;
+
+ /*
* spaces from the switch() indent a "case xx" label should be located
*/
int ind_case = curbuf->b_p_sw;
***************
*** 6245,6250 ****
--- 6251,6257 ----
case '{': ind_open_extra = n; break;
case '}': ind_close_extra = n; break;
case '^': ind_open_left_imag = n; break;
+ case 'J': ind_jump_label = n; break;
case ':': ind_case = n; break;
case '=': ind_case_code = n; break;
case 'b': ind_case_break = n; break;
***************
*** 6300,6305 ****
--- 6307,6314 ----
curwin->w_cursor.col = 0;
+ int original_line_islabel = cin_islabel(ind_maxcomment);
+
/*
* #defines and so on always go at the left when included in 'cinkeys'.
*/
***************
*** 6309,6317 ****
}
/*
! * Is it a non-case label? Then that goes at the left margin too.
*/
! else if (cin_islabel(ind_maxcomment)) /* XXX */
{
amount = 0;
}
--- 6318,6326 ----
}
/*
! * put jump labels to the left if not configured otherwise.
*/
! else if (ind_jump_label < 0 && original_line_islabel) /* XXX */
{
amount = 0;
}
***************
*** 7929,7934 ****
--- 7938,7948 ----
}
theend:
+ // QUESTION: Is this the right place to shift jump labels?
+ /* add extra left-shift for jump labels */
+ if (ind_jump_label > 0 && original_line_islabel)
+ amount -= ind_jump_label;
+
/* put the cursor back where it belongs */
curwin->w_cursor = cur_curpos;