To: vim-dev@vim.org Subject: Patch 6.0.177 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.177 Problem: When 'commentstring' is empty and 'foldmethod' is "marker", "zf" doesn't work. (Thomas S. Urban) Solution: Add the marker even when 'commentstring' is empty. Files: src/fold.c, src/normal.c *** ../vim60.176/src/fold.c Mon Oct 29 09:34:01 2001 --- src/fold.c Mon Feb 4 17:19:15 2002 *************** *** 547,554 **** foldManualAllowed(create) int create; { ! if (foldmethodIsManual(curwin) ! || (foldmethodIsMarker(curwin) && *curbuf->b_p_cms != NUL)) return TRUE; if (create) EMSG(_("E350: Cannot create fold with current 'foldmethod'")); --- 547,553 ---- foldManualAllowed(create) int create; { ! if (foldmethodIsManual(curwin) || foldmethodIsMarker(curwin)) return TRUE; if (create) EMSG(_("E350: Cannot create fold with current 'foldmethod'")); *************** *** 1696,1706 **** EMSG(_(e_modifiable)); return; } - if (*curbuf->b_p_cms == NUL) - { - EMSG(_("E221: 'commentstring' is empty")); - return; - } parseMarker(curwin); foldAddMarker(start, curwin->w_p_fmr, foldstartmarkerlen); --- 1695,1700 ---- *************** *** 1730,1745 **** /* Allocate a new line: old-line + 'cms'-start + marker + 'cms'-end */ line = ml_get(lnum); line_len = (int)STRLEN(line); - newline = alloc((unsigned)(line_len + markerlen + STRLEN(cms) - 1)); - if (newline == NULL) - return; if (u_save(lnum - 1, lnum + 1) == OK) { STRCPY(newline, line); ! STRCPY(newline + line_len, cms); ! STRNCPY(newline + line_len + (p - cms), marker, markerlen); ! STRCPY(newline + line_len + (p - cms) + markerlen, p + 2); ml_replace(lnum, newline, FALSE); } --- 1724,1747 ---- /* Allocate a new line: old-line + 'cms'-start + marker + 'cms'-end */ line = ml_get(lnum); line_len = (int)STRLEN(line); if (u_save(lnum - 1, lnum + 1) == OK) { + newline = alloc((unsigned)(line_len + markerlen + STRLEN(cms) + 1)); + if (newline == NULL) + return; STRCPY(newline, line); ! if (p == NULL) ! { ! STRNCPY(newline + line_len, marker, markerlen); ! newline[line_len + markerlen] = NUL; ! } ! else ! { ! STRCPY(newline + line_len, cms); ! STRNCPY(newline + line_len + (p - cms), marker, markerlen); ! STRCPY(newline + line_len + (p - cms) + markerlen, p + 2); ! } ml_replace(lnum, newline, FALSE); } *************** *** 3084,3090 **** return OK; } ! /* put_folds_recurse() {{{2 */ /* * Write commands to "fd" to open and close manually opened/closed folds. * Returns FAIL when writing failed. --- 3086,3092 ---- return OK; } ! /* put_foldopen_recurse() {{{2 */ /* * Write commands to "fd" to open and close manually opened/closed folds. * Returns FAIL when writing failed. *** ../vim60.176/src/version.c Mon Feb 4 17:08:29 2002 --- src/version.c Mon Feb 4 17:25:21 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 177, /**/ -- hundred-and-one symptoms of being an internet addict: 200. You really believe in the concept of a "paperless" office. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///