home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: patch 5.5.053
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- ------------
-
- Patch 5.5.053
- Problem: Indenting is wrong after a function when 'cino' has "fs". Another
- problem when 'cino' has "{s".
- Solution: Put line after closing "}" of a function at the left margin.
- Apply ind_open_extra in the right way after a '{'.
- Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
-
-
- *** ../vim-5.5.52/src/misc1.c Wed Sep 22 10:06:23 1999
- --- src/misc1.c Thu Nov 4 10:17:00 1999
- ***************
- *** 4199,4204 ****
- --- 4199,4205 ----
- amount += ind_open_imag;
- else
- {
- + /* Compensate for adding ind_open_extra later. */
- amount -= ind_open_extra;
- if (amount < 0)
- amount = 0;
- ***************
- *** 4246,4252 ****
- --- 4247,4257 ----
- if (lookfor == LOOKFOR_UNTERM)
- amount += ind_continuation;
- else if (lookfor != LOOKFOR_TERM)
- + {
- amount = scope_amount;
- + if (theline[0] == '{')
- + amount += ind_open_extra;
- + }
- break;
- }
-
- ***************
- *** 4427,4433 ****
- */
- if (lookfor != LOOKFOR_TERM && theline[0] == '{')
- {
- ! amount = cur_amount + ind_open_extra;
- break;
- }
-
- --- 4432,4447 ----
- */
- if (lookfor != LOOKFOR_TERM && theline[0] == '{')
- {
- ! amount = cur_amount;
- ! /*
- ! * Only add ind_open_extra when the current line
- ! * doesn't start with a '{', which must have a match
- ! * in the same line (scope is the same). Probably:
- ! * { 1, 2 },
- ! * -> { 3, 4 }
- ! */
- ! if (*skipwhite(l) != '{')
- ! amount += ind_open_extra;
- break;
- }
-
- ***************
- *** 4464,4469 ****
- --- 4478,4485 ----
- * -> here;
- */
- amount = cur_amount;
- + if (theline[0] == '{')
- + amount += ind_open_extra;
- if (lookfor != LOOKFOR_TERM)
- {
- amount += ind_level + ind_no_brace;
- ***************
- *** 4655,4660 ****
- --- 4671,4679 ----
-
- if (theline[0] == '{')
- amount += ind_open_extra;
- + /* See remark above: "Only add ind_open_extra.." */
- + if (*skipwhite(l) == '{')
- + amount -= ind_open_extra;
- lookfor = LOOKFOR_TERM;
-
- /*
- ***************
- *** 4740,4745 ****
- --- 4759,4771 ----
- * not in a comment, put it the left margin.
- */
- if (cin_isfuncdecl(theline))
- + break;
- +
- + /*
- + * Finding the closing '}' of a previous function. Put
- + * current line at the left margin. For when 'cino' has "fs".
- + */
- + if (*skipwhite(l) == '}')
- break;
-
- /*
- *** ../vim-5.5.52/src/testdir/test3.in Wed Sep 22 10:06:10 1999
- --- src/testdir/test3.in Thu Nov 4 10:32:51 1999
- ***************
- *** 643,648 ****
- --- 643,686 ----
- }
-
- STARTTEST
- + :set cino={s,fs
- + ]]=/ foo
- + ENDTEST
- +
- + void bar(void)
- + {
- + static array[2][2] =
- + {
- + { 1, 2 },
- + { 3, 4 },
- + }
- +
- + while (a)
- + {
- + foo(&a);
- + }
- +
- + {
- + int a;
- + {
- + a = a + 1;
- + }
- + }
- + b = a;
- + }
- +
- + void func(void)
- + {
- + a = 1;
- + {
- + b = 2;
- + }
- + c = 3;
- + d = 4;
- + }
- + /* foo */
- +
- + STARTTEST
- :set cino=
- /while
- ohere
- *** ../vim-5.5.52/src/testdir/test3.ok Wed Sep 22 10:06:10 1999
- --- src/testdir/test3.ok Sat Dec 4 20:28:17 1999
- ***************
- *** 640,645 ****
- --- 640,683 ----
- }
-
- STARTTEST
- + :set cino={s,fs
- + ]]=/ foo
- + ENDTEST
- +
- + void bar(void)
- + {
- + static array[2][2] =
- + {
- + { 1, 2 },
- + { 3, 4 },
- + }
- +
- + while (a)
- + {
- + foo(&a);
- + }
- +
- + {
- + int a;
- + {
- + a = a + 1;
- + }
- + }
- + b = a;
- + }
- +
- + void func(void)
- + {
- + a = 1;
- + {
- + b = 2;
- + }
- + c = 3;
- + d = 4;
- + }
- + /* foo */
- +
- + STARTTEST
- :set cino=
- /while
- ohere
- *** ../vim-5.5.52/src/version.c Sat Dec 4 20:31:11 1999
- --- src/version.c Sat Dec 4 20:31:33 1999
- ***************
- *** 420,420 ****
- --- 420,421 ----
- { /* Add new patch number below this line */
- + 53,
-
- --
- "The amigos also appear to be guilty of not citing the work of others who had
- gone before them. Even worse, they have a chapter about modeling time and
- space without making a single reference to Star Trek!"
- (Scott Ambler, reviewing the UML User Guide)
-
- --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /
-