1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: When joining lines comment leaders need to be removed manually.
12 Solution: Add the 'j' flag to 'formatoptions'. (Lech Lorens)
13 Files: runtime/doc/change.txt, src/edit.c, src/ex_docmd.c, src/misc1.c,
14 src/normal.c, src/ops.c, src/option.h, src/proto/misc1.pro,
15 src/proto/ops.pro, src/search.c, src/testdir/test29.in,
19 *** ../vim-7.3.540/runtime/doc/change.txt 2011-05-05 14:26:37.000000000 +0200
20 --- runtime/doc/change.txt 2012-06-06 13:05:04.000000000 +0200
24 characters. Overruled by the 'M' flag.
25 1 Don't break a line after a one-letter word. It's broken before it
26 instead (if possible).
27 + j Where it makes sense, remove a comment leader when joining lines. For
29 + int i; // the index ~
32 + int i; // the index in the list ~
35 With 't' and 'c' you can specify when Vim performs auto-wrapping:
36 *** ../vim-7.3.540/src/edit.c 2012-06-01 15:20:49.000000000 +0200
37 --- src/edit.c 2012-06-06 13:00:29.000000000 +0200
40 * Need to remove existing (middle) comment leader and insert end
41 * comment leader. First, check what comment leader we can find.
43 ! i = get_leader_len(line = ml_get_curline(), &p, FALSE);
44 if (i > 0 && vim_strchr(p, COM_MIDDLE) != NULL) /* Just checking */
46 /* Skip middle-comment string */
48 * Need to remove existing (middle) comment leader and insert end
49 * comment leader. First, check what comment leader we can find.
51 ! i = get_leader_len(line = ml_get_curline(), &p, FALSE, TRUE);
52 if (i > 0 && vim_strchr(p, COM_MIDDLE) != NULL) /* Just checking */
54 /* Skip middle-comment string */
58 /* Don't break until after the comment leader */
60 ! leader_len = get_leader_len(ml_get_curline(), NULL, FALSE);
66 /* Don't break until after the comment leader */
68 ! leader_len = get_leader_len(ml_get_curline(), NULL, FALSE, TRUE);
74 /* With the 'c' flag in 'formatoptions' and 't' missing: only format
76 if (has_format_option(FO_WRAP_COMS) && !has_format_option(FO_WRAP)
77 ! && get_leader_len(old, NULL, FALSE) == 0)
82 /* With the 'c' flag in 'formatoptions' and 't' missing: only format
84 if (has_format_option(FO_WRAP_COMS) && !has_format_option(FO_WRAP)
85 ! && get_leader_len(old, NULL, FALSE, TRUE) == 0)
92 temp = curwin->w_cursor.col;
93 if (!can_bs(BS_EOL) /* only if "eol" included */
94 ! || do_join(2, FALSE, TRUE) == FAIL)
97 curwin->w_cursor.col = temp;
100 temp = curwin->w_cursor.col;
101 if (!can_bs(BS_EOL) /* only if "eol" included */
102 ! || do_join(2, FALSE, TRUE, FALSE) == FAIL)
105 curwin->w_cursor.col = temp;
111 ! (void)do_join(2, FALSE, FALSE);
112 if (temp == NUL && gchar_cursor() != NUL)
119 ! (void)do_join(2, FALSE, FALSE, FALSE);
120 if (temp == NUL && gchar_cursor() != NUL)
123 *** ../vim-7.3.540/src/ex_docmd.c 2012-04-30 18:48:38.000000000 +0200
124 --- src/ex_docmd.c 2012-06-06 13:00:29.000000000 +0200
130 ! (void)do_join(eap->line2 - eap->line1 + 1, !eap->forceit, TRUE);
131 beginline(BL_WHITE | BL_FIX);
138 ! (void)do_join(eap->line2 - eap->line1 + 1, !eap->forceit, TRUE, TRUE);
139 beginline(BL_WHITE | BL_FIX);
142 *** ../vim-7.3.540/src/misc1.c 2012-06-01 15:20:49.000000000 +0200
143 --- src/misc1.c 2012-06-06 13:27:32.000000000 +0200
147 # ifdef FEAT_COMMENTS
148 if (flags & OPENLINE_DO_COM)
149 ! lead_len = get_leader_len(ptr, NULL, FALSE);
155 # ifdef FEAT_COMMENTS
156 if (flags & OPENLINE_DO_COM)
157 ! lead_len = get_leader_len(ptr, NULL, FALSE, TRUE);
164 # ifdef FEAT_COMMENTS
165 if (flags & OPENLINE_DO_COM)
166 ! lead_len = get_leader_len(ptr, NULL, FALSE);
172 # ifdef FEAT_COMMENTS
173 if (flags & OPENLINE_DO_COM)
174 ! lead_len = get_leader_len(ptr, NULL, FALSE, TRUE);
181 end_comment_pending = NUL;
182 if (flags & OPENLINE_DO_COM)
183 ! lead_len = get_leader_len(saved_line, &lead_flags, dir == BACKWARD);
189 end_comment_pending = NUL;
190 if (flags & OPENLINE_DO_COM)
191 ! lead_len = get_leader_len(saved_line, &lead_flags, dir == BACKWARD, TRUE);
197 * When "flags" is not NULL, it is set to point to the flags of the recognized
199 * "backward" must be true for the "O" command.
202 ! get_leader_len(line, flags, backward)
210 char_u part_buf[COM_MAX_LEN]; /* buffer for one option part */
212 * When "flags" is not NULL, it is set to point to the flags of the recognized
214 * "backward" must be true for the "O" command.
215 + * If "include_space" is set, include trailing whitespace while calculating the
219 ! get_leader_len(line, flags, backward, include_space)
229 char_u part_buf[COM_MAX_LEN]; /* buffer for one option part */
233 char_u *saved_flags = NULL;
236 while (vim_iswhite(line[i])) /* leading white space is ignored */
241 char_u *saved_flags = NULL;
244 while (vim_iswhite(line[i])) /* leading white space is ignored */
252 /* Include any trailing white space. */
253 while (vim_iswhite(line[i]))
256 /* If this comment doesn't nest, stop here. */
258 if (vim_strchr(part_buf, COM_NEST) == NULL)
262 ! return (got_com ? i : 0);
272 /* Include any trailing white space. */
273 while (vim_iswhite(line[i]))
279 /* If this comment doesn't nest, stop here. */
281 if (vim_strchr(part_buf, COM_NEST) == NULL)
288 + * Return the offset at which the last comment in line starts. If there is no
289 + * comment in the whole line, -1 is returned.
291 + * When "flags" is not null, it is set to point to the flags describing the
292 + * recognized comment leader.
295 + get_last_leader_offset(line, flags)
301 + int lower_check_bound = 0;
303 + char_u *com_leader;
307 + char_u part_buf[COM_MAX_LEN]; /* buffer for one option part */
310 + * Repeat to match several nested comment strings.
312 + i = (int)STRLEN(line);
313 + while (--i >= lower_check_bound)
316 + * scan through the 'comments' option for a match
319 + for (list = curbuf->b_p_com; *list; )
321 + char_u *flags_save = list;
324 + * Get one option part into part_buf[]. Advance list to next one.
325 + * put string at start of string.
327 + (void)copy_option_part(&list, part_buf, COM_MAX_LEN, ",");
328 + string = vim_strchr(part_buf, ':');
329 + if (string == NULL) /* If everything is fine, this cannot actually
334 + *string++ = NUL; /* Isolate flags from string. */
335 + com_leader = string;
338 + * Line contents and string must match.
339 + * When string starts with white space, must have some white space
340 + * (but the amount does not need to match, there might be a mix of
341 + * TABs and spaces).
343 + if (vim_iswhite(string[0]))
345 + if (i == 0 || !vim_iswhite(line[i - 1]))
347 + while (vim_iswhite(string[0]))
350 + for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j)
352 + if (string[j] != NUL)
356 + * When 'b' flag used, there must be white space or an
357 + * end-of-line after the string in the line.
359 + if (vim_strchr(part_buf, COM_BLANK) != NULL
360 + && !vim_iswhite(line[i + j]) && line[i + j] != NUL)
366 + * We have found a match, stop searching.
371 + *flags = flags_save;
372 + com_flags = flags_save;
379 ! char_u part_buf2[COM_MAX_LEN]; /* buffer for one option part */
380 ! int len1, len2, off;
384 ! * If this comment nests, continue searching.
386 ! if (vim_strchr(part_buf, COM_NEST) != NULL)
389 ! lower_check_bound = i;
391 ! /* Let's verify whether the comment leader found is a substring
392 ! * of other comment leaders. If it is, let's adjust the
393 ! * lower_check_bound so that we make sure that we have determined
394 ! * the comment leader correctly.
397 ! while (vim_iswhite(*com_leader))
399 ! len1 = (int)STRLEN(com_leader);
401 ! for (list = curbuf->b_p_com; *list; )
403 ! char_u *flags_save = list;
405 ! (void)copy_option_part(&list, part_buf2, COM_MAX_LEN, ",");
406 ! if (flags_save == com_flags)
408 ! string = vim_strchr(part_buf2, ':');
410 ! while (vim_iswhite(*string))
412 ! len2 = (int)STRLEN(string);
416 ! /* Now we have to verify whether string ends with a substring
417 ! * beginning the com_leader. */
418 ! for (off = (len2 > i ? i : len2); off > 0 && off + len1 > len2;)
421 ! if (!STRNCMP(string + off, com_leader, len2 - off))
423 ! if (i - off < lower_check_bound)
424 ! lower_check_bound = i - off;
434 *** ../vim-7.3.540/src/normal.c 2012-05-25 13:12:33.000000000 +0200
435 --- src/normal.c 2012-06-06 13:00:29.000000000 +0200
441 ! (void)do_join(oap->line_count, oap->op_type == OP_JOIN, TRUE);
442 auto_format(FALSE, TRUE);
449 ! (void)do_join(oap->line_count, oap->op_type == OP_JOIN, TRUE, TRUE);
450 auto_format(FALSE, TRUE);
458 ! if (get_leader_len(ml_get_curline(), NULL, FALSE) > 0)
460 /* Ignore this line, continue at start of next line. */
461 ++curwin->w_cursor.lnum;
466 ! if (get_leader_len(ml_get_curline(), NULL, FALSE, TRUE) > 0)
468 /* Ignore this line, continue at start of next line. */
469 ++curwin->w_cursor.lnum;
473 prep_redo(cap->oap->regname, cap->count0,
474 NUL, cap->cmdchar, NUL, NUL, cap->nchar);
475 ! (void)do_join(cap->count0, cap->nchar == NUL, TRUE);
481 prep_redo(cap->oap->regname, cap->count0,
482 NUL, cap->cmdchar, NUL, NUL, cap->nchar);
483 ! (void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE);
487 *** ../vim-7.3.540/src/ops.c 2012-05-18 12:49:33.000000000 +0200
488 --- src/ops.c 2012-06-06 15:43:31.000000000 +0200
494 static void dis_msg __ARGS((char_u *p, int skip_esc));
495 + #if defined(FEAT_COMMENTS) || defined(PROTO)
496 + static char_u *skip_comment __ARGS((char_u *line, int process, int include_space, int *is_comment));
499 static void block_prep __ARGS((oparg_T *oap, struct block_def *, linenr_T, int));
503 curwin->w_cursor = curpos; /* restore curwin->w_cursor */
505 if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
506 ! (void)do_join(2, FALSE, FALSE);
511 curwin->w_cursor = curpos; /* restore curwin->w_cursor */
513 if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
514 ! (void)do_join(2, FALSE, FALSE, FALSE);
524 * Join 'count' lines (minimal 2) at cursor position.
525 * When "save_undo" is TRUE save lines for undo first.
527 * return FAIL for failure, OK otherwise
530 ! do_join(count, insert_space, save_undo)
536 char_u *curr_start = NULL;
541 + #if defined(FEAT_COMMENTS) || defined(PROTO)
543 + * If "process" is TRUE and the line begins with a comment leader (possibly
544 + * after some white space), return a pointer to the text after it. Put a boolean
545 + * value indicating whether the line ends with an unclosed comment in
547 + * line - line to be processed,
548 + * process - if FALSE, will only check whether the line ends with an unclosed
550 + * include_space - whether to also skip space following the comment leader,
551 + * is_comment - will indicate whether the current line ends with an unclosed
555 + skip_comment(line, process, include_space, is_comment)
561 + char_u *comment_flags = NULL;
563 + int leader_offset = get_last_leader_offset(line, &comment_flags);
565 + *is_comment = FALSE;
566 + if (leader_offset != -1)
568 + /* Let's check whether the line ends with an unclosed comment.
569 + * If the last comment leader has COM_END in flags, there's no comment.
571 + while (*comment_flags)
573 + if (*comment_flags == COM_END
574 + || *comment_flags == ':')
578 + if (*comment_flags != COM_END)
579 + *is_comment = TRUE;
582 + if (process == FALSE)
585 + lead_len = get_leader_len(line, &comment_flags, FALSE, include_space);
594 + * whichever comes first.
596 + while (*comment_flags)
598 + if (*comment_flags == COM_START
599 + || *comment_flags == COM_END
600 + || *comment_flags == ':')
607 + /* If we found a colon, it means that we are not processing a line
608 + * starting with an opening or a closing part of a three-part
609 + * comment. That's good, because we don't want to remove those as
610 + * this would be annoying.
612 + if (*comment_flags == ':' || *comment_flags == NUL)
620 * Join 'count' lines (minimal 2) at cursor position.
621 * When "save_undo" is TRUE save lines for undo first.
622 + * Set "use_formatoptions" to FALSE when e.g. processing
623 + * backspace and comment leaders should not be removed.
625 * return FAIL for failure, OK otherwise
628 ! do_join(count, insert_space, save_undo, use_formatoptions)
632 + int use_formatoptions UNUSED;
635 char_u *curr_start = NULL;
642 + #if defined(FEAT_COMMENTS) || defined(PROTO)
644 + int remove_comments = (use_formatoptions == TRUE)
645 + && has_format_option(FO_REMOVE_COMS);
646 + int prev_was_comment;
650 if (save_undo && u_save((linenr_T)(curwin->w_cursor.lnum - 1),
651 (linenr_T)(curwin->w_cursor.lnum + count)) == FAIL)
655 spaces = lalloc_clear((long_u)count, TRUE);
658 + #if defined(FEAT_COMMENTS) || defined(PROTO)
659 + if (remove_comments)
661 + comments = (int *)lalloc_clear((long_u)count * sizeof(int), TRUE);
662 + if (comments == NULL)
671 * Don't move anything, just compute the final line length
675 for (t = 0; t < count; ++t)
677 curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
678 + #if defined(FEAT_COMMENTS) || defined(PROTO)
679 + if (remove_comments)
681 + /* We don't want to remove the comment leader if the
682 + * previous line is not a comment. */
683 + if (t > 0 && prev_was_comment)
686 + char_u *new_curr = skip_comment(curr, TRUE, insert_space,
687 + &prev_was_comment);
688 + comments[t] = new_curr - curr;
692 + curr = skip_comment(curr, FALSE, insert_space,
693 + &prev_was_comment);
697 if (insert_space && t > 0)
699 curr = skipwhite(curr);
705 curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1));
706 + #if defined(FEAT_COMMENTS) || defined(PROTO)
707 + if (remove_comments)
708 + curr += comments[t - 1];
710 if (insert_space && t > 1)
711 curr = skipwhite(curr);
712 currsize = (int)STRLEN(curr);
719 + #if defined(FEAT_COMMENTS) || defined(PROTO)
720 + if (remove_comments)
721 + vim_free(comments);
728 (long)-next_leader_len);
730 curwin->w_cursor.lnum--;
731 ! if (do_join(2, TRUE, FALSE) == FAIL)
736 (long)-next_leader_len);
738 curwin->w_cursor.lnum--;
739 ! if (do_join(2, TRUE, FALSE, FALSE) == FAIL)
748 ! *leader_len = get_leader_len(ptr, leader_flags, FALSE);
756 ! *leader_len = get_leader_len(ptr, leader_flags, FALSE, TRUE);
760 *** ../vim-7.3.540/src/option.h 2012-02-20 22:18:22.000000000 +0100
761 --- src/option.h 2012-06-06 13:00:29.000000000 +0200
764 #define FO_ONE_LETTER '1'
765 #define FO_WHITE_PAR 'w' /* trailing white space continues paragr. */
766 #define FO_AUTO 'a' /* automatic formatting */
768 #define DFLT_FO_VI "vt"
769 #define DFLT_FO_VIM "tcq"
770 ! #define FO_ALL "tcroq2vlb1mMBn,aw" /* for do_set() */
772 /* characters for the p_cpo option: */
773 #define CPO_ALTREAD 'a' /* ":read" sets alternate file name */
775 #define FO_ONE_LETTER '1'
776 #define FO_WHITE_PAR 'w' /* trailing white space continues paragr. */
777 #define FO_AUTO 'a' /* automatic formatting */
778 + #define FO_REMOVE_COMS 'j' /* remove comment leaders when joining lines */
780 #define DFLT_FO_VI "vt"
781 #define DFLT_FO_VIM "tcq"
782 ! #define FO_ALL "tcroq2vlb1mMBn,awj" /* for do_set() */
784 /* characters for the p_cpo option: */
785 #define CPO_ALTREAD 'a' /* ":read" sets alternate file name */
786 *** ../vim-7.3.540/src/proto/misc1.pro 2010-08-15 21:57:28.000000000 +0200
787 --- src/proto/misc1.pro 2012-06-06 13:00:29.000000000 +0200
790 int set_indent __ARGS((int size, int flags));
791 int get_number_indent __ARGS((linenr_T lnum));
792 int open_line __ARGS((int dir, int flags, int old_indent));
793 ! int get_leader_len __ARGS((char_u *line, char_u **flags, int backward));
794 int plines __ARGS((linenr_T lnum));
795 int plines_win __ARGS((win_T *wp, linenr_T lnum, int winheight));
796 int plines_nofill __ARGS((linenr_T lnum));
798 int set_indent __ARGS((int size, int flags));
799 int get_number_indent __ARGS((linenr_T lnum));
800 int open_line __ARGS((int dir, int flags, int old_indent));
801 ! int get_leader_len __ARGS((char_u *line, char_u **flags, int backward, int do_skip_space));
802 ! int get_last_leader_offset __ARGS((char_u *line, char_u **flags));
803 int plines __ARGS((linenr_T lnum));
804 int plines_win __ARGS((win_T *wp, linenr_T lnum, int winheight));
805 int plines_nofill __ARGS((linenr_T lnum));
806 *** ../vim-7.3.540/src/proto/ops.pro 2010-08-15 21:57:28.000000000 +0200
807 --- src/proto/ops.pro 2012-06-06 13:00:29.000000000 +0200
810 int preprocs_left __ARGS((void));
811 int get_register_name __ARGS((int num));
812 void ex_display __ARGS((exarg_T *eap));
813 ! int do_join __ARGS((long count, int insert_space, int save_undo));
814 void op_format __ARGS((oparg_T *oap, int keep_cursor));
815 void op_formatexpr __ARGS((oparg_T *oap));
816 int fex_format __ARGS((linenr_T lnum, long count, int c));
818 int preprocs_left __ARGS((void));
819 int get_register_name __ARGS((int num));
820 void ex_display __ARGS((exarg_T *eap));
821 ! int do_join __ARGS((long count, int insert_space, int save_undo, int use_formatoptions));
822 void op_format __ARGS((oparg_T *oap, int keep_cursor));
823 void op_formatexpr __ARGS((oparg_T *oap));
824 int fex_format __ARGS((linenr_T lnum, long count, int c));
825 *** ../vim-7.3.540/src/search.c 2012-02-04 23:34:57.000000000 +0100
826 --- src/search.c 2012-06-06 13:00:29.000000000 +0200
832 ! static char_u bytes[MB_MAXBYTES];
833 static int bytelen = 1; /* >1 for multi-byte char */
840 ! static char_u bytes[MB_MAXBYTES + 1];
841 static int bytelen = 1; /* >1 for multi-byte char */
848 STRNCMP(skipwhite(line + 1), "define", 6) != 0)
849 ! && get_leader_len(line, NULL, FALSE))
856 STRNCMP(skipwhite(line + 1), "define", 6) != 0)
857 ! && get_leader_len(line, NULL, FALSE, TRUE))
861 *** ../vim-7.3.540/src/testdir/test29.in 2010-08-15 21:57:29.000000000 +0200
862 --- src/testdir/test29.in 2012-06-06 15:44:38.000000000 +0200
865 and with 'cpoptions' flag 'j' set or not
868 :set nocompatible viminfo+=nviminfo
872 ! j"tdGpJjJjJjJjJjJjJjJjJjJjJjJjJjJj05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions+=j
873 j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions-=j joinspaces
874 j"tpJjJjJjJjJjJjJjJjJjJjJjJjJjJj05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions+=j
875 j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions-=j nojoinspaces compatible
876 ! j"tpJjJjJjJjJjJjJjJjJjJjJjJjJjJj4Jy3l$pjdG:?firstline?+1,$w! test.out
882 and with 'cpoptions' flag 'j' set or not
886 :set nocompatible viminfo+=nviminfo
891 ! PJjJjJjJjJjJjJjJjJjJjJjJjJjJj05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions+=j
892 j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions-=j joinspaces
893 j"tpJjJjJjJjJjJjJjJjJjJjJjJjJjJj05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions+=j
894 j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions-=j nojoinspaces compatible
895 ! j"tpJjJjJjJjJjJjJjJjJjJjJjJjJjJj4Jy3l$pjd/STARTTEST/-2
907 + :set comments=s1:/*,mb:*,ex:*/,://
908 + :set nojoinspaces fo=j
909 + :set backspace=eol,start
923 + * Make sure the previous comment leader is not removed.
927 + * Make sure the previous comment leader is not removed.
930 + // Should the next comment leader be left alone?
933 + // Should the next comment leader be left alone?
936 + /* Here the comment leader should be left intact. */
937 + // And so should this one.
939 + /* Here the comment leader should be left intact. */
940 + // And so should this one.
942 + if (condition) // Remove the next comment leader!
946 + if (condition) // Remove the next comment leader!
953 + :set comments=s1:/*,mb:*,ex:*/,://
954 + :set comments+=s1:>#,mb:#,ex:#<,:<
955 + :set cpoptions-=j joinspaces fo=j
956 + :set backspace=eol,start
969 + oSome code!
// Make sure backspacing does not remove this comment leader.
\e0i
\b\e
975 + * Make sure the previous comment leader is not removed.
979 + * Make sure the previous comment leader is not removed.
982 + // Should the next comment leader be left alone?
985 + // Should the next comment leader be left alone?
988 + /* Here the comment leader should be left intact. */
989 + // And so should this one.
991 + /* Here the comment leader should be left intact. */
992 + // And so should this one.
994 + if (condition) // Remove the next comment leader!
998 + if (condition) // Remove the next comment leader!
1002 + int i = 7 /* foo *// 3
1006 + int i = 7 /* foo *// 3
1010 + ># Note that the last character of the ending comment leader (left angle
1011 + # bracket) is a comment leader itself. Make sure that this comment leader is
1012 + # not removed from the next line #<
1013 + < On this line a new comment is opened which spans 2 lines. This comment should
1014 + < retain its comment leader.
1016 + ># Note that the last character of the ending comment leader (left angle
1017 + # bracket) is a comment leader itself. Make sure that this comment leader is
1018 + # not removed from the next line #<
1019 + < On this line a new comment is opened which spans 2 lines. This comment should
1020 + < retain its comment leader.
1025 + :g/^STARTTEST/.,/^ENDTEST/d
1026 + :?firstline?+1,$w! test.out
1029 *** ../vim-7.3.540/src/testdir/test29.ok 2010-08-15 21:57:29.000000000 +0200
1030 --- src/testdir/test29.ok 2012-06-06 13:00:29.000000000 +0200
1036 zx cvn. as dfg? hjkl iop! ert a
1040 + /* Make sure the previous comment leader is not removed. */
1041 + /* Make sure the previous comment leader is not removed. */
1042 + // Should the next comment leader be left alone? Yes.
1043 + // Should the next comment leader be left alone? Yes.
1044 + /* Here the comment leader should be left intact. */ // And so should this one.
1045 + /* Here the comment leader should be left intact. */ // And so should this one.
1046 + if (condition) // Remove the next comment leader! OK, I will.
1048 + if (condition) // Remove the next comment leader! OK, I will.
1054 + /* Make sure the previous comment leader is not removed. */
1055 + /* Make sure the previous comment leader is not removed. */
1056 + // Should the next comment leader be left alone? Yes.
1057 + // Should the next comment leader be left alone? Yes.
1058 + /* Here the comment leader should be left intact. */ // And so should this one.
1059 + /* Here the comment leader should be left intact. */ // And so should this one.
1060 + if (condition) // Remove the next comment leader! OK, I will.
1062 + if (condition) // Remove the next comment leader! OK, I will.
1064 + int i = 7 /* foo *// 3 // comment
1066 + int i = 7 /* foo *// 3 // comment
1068 + ># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader.
1069 + ># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader.
1071 + Some code!// Make sure backspacing does not remove this comment leader.
1074 *** ../vim-7.3.540/src/version.c 2012-06-06 12:06:10.000000000 +0200
1075 --- src/version.c 2012-06-06 16:10:03.000000000 +0200
1079 { /* Add new patch number below this line */
1085 I have a drinking problem -- I don't have a drink!
1087 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
1088 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
1089 \\\ an exciting new programming language -- http://www.Zimbu.org ///
1090 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///