mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 7.4.1207
Problem: Using old style function declarations. Solution: Change to new style function declarations. (script by Hirohito Higashi)
This commit is contained in:
374
src/fold.c
374
src/fold.c
@@ -100,9 +100,7 @@ static int foldendmarkerlen;
|
||||
* Copy that folding state from window "wp_from" to window "wp_to".
|
||||
*/
|
||||
void
|
||||
copyFoldingState(wp_from, wp_to)
|
||||
win_T *wp_from;
|
||||
win_T *wp_to;
|
||||
copyFoldingState(win_T *wp_from, win_T *wp_to)
|
||||
{
|
||||
wp_to->w_fold_manual = wp_from->w_fold_manual;
|
||||
wp_to->w_foldinvalid = wp_from->w_foldinvalid;
|
||||
@@ -115,8 +113,7 @@ copyFoldingState(wp_from, wp_to)
|
||||
* Return TRUE if there may be folded lines in the current window.
|
||||
*/
|
||||
int
|
||||
hasAnyFolding(win)
|
||||
win_T *win;
|
||||
hasAnyFolding(win_T *win)
|
||||
{
|
||||
/* very simple now, but can become more complex later */
|
||||
return (win->w_p_fen
|
||||
@@ -131,23 +128,20 @@ hasAnyFolding(win)
|
||||
* lnum of the sequence of folded lines (skipped when NULL).
|
||||
*/
|
||||
int
|
||||
hasFolding(lnum, firstp, lastp)
|
||||
linenr_T lnum;
|
||||
linenr_T *firstp;
|
||||
linenr_T *lastp;
|
||||
hasFolding(linenr_T lnum, linenr_T *firstp, linenr_T *lastp)
|
||||
{
|
||||
return hasFoldingWin(curwin, lnum, firstp, lastp, TRUE, NULL);
|
||||
}
|
||||
|
||||
/* hasFoldingWin() {{{2 */
|
||||
int
|
||||
hasFoldingWin(win, lnum, firstp, lastp, cache, infop)
|
||||
win_T *win;
|
||||
linenr_T lnum;
|
||||
linenr_T *firstp;
|
||||
linenr_T *lastp;
|
||||
int cache; /* when TRUE: use cached values of window */
|
||||
foldinfo_T *infop; /* where to store fold info */
|
||||
hasFoldingWin(
|
||||
win_T *win,
|
||||
linenr_T lnum,
|
||||
linenr_T *firstp,
|
||||
linenr_T *lastp,
|
||||
int cache, /* when TRUE: use cached values of window */
|
||||
foldinfo_T *infop) /* where to store fold info */
|
||||
{
|
||||
int had_folded = FALSE;
|
||||
linenr_T first = 0;
|
||||
@@ -254,8 +248,7 @@ hasFoldingWin(win, lnum, firstp, lastp, cache, infop)
|
||||
* Return fold level at line number "lnum" in the current window.
|
||||
*/
|
||||
int
|
||||
foldLevel(lnum)
|
||||
linenr_T lnum;
|
||||
foldLevel(linenr_T lnum)
|
||||
{
|
||||
/* While updating the folds lines between invalid_top and invalid_bot have
|
||||
* an undefined fold level. Otherwise update the folds first. */
|
||||
@@ -281,9 +274,7 @@ foldLevel(lnum)
|
||||
* Return MAYBE if the line is folded when next to a folded line.
|
||||
*/
|
||||
int
|
||||
lineFolded(win, lnum)
|
||||
win_T *win;
|
||||
linenr_T lnum;
|
||||
lineFolded(win_T *win, linenr_T lnum)
|
||||
{
|
||||
return foldedCount(win, lnum, NULL) != 0;
|
||||
}
|
||||
@@ -298,10 +289,7 @@ lineFolded(win, lnum)
|
||||
* When "infop" is not NULL, fills *infop with the fold level info.
|
||||
*/
|
||||
long
|
||||
foldedCount(win, lnum, infop)
|
||||
win_T *win;
|
||||
linenr_T lnum;
|
||||
foldinfo_T *infop;
|
||||
foldedCount(win_T *win, linenr_T lnum, foldinfo_T *infop)
|
||||
{
|
||||
linenr_T last;
|
||||
|
||||
@@ -315,8 +303,7 @@ foldedCount(win, lnum, infop)
|
||||
* Return TRUE if 'foldmethod' is "manual"
|
||||
*/
|
||||
int
|
||||
foldmethodIsManual(wp)
|
||||
win_T *wp;
|
||||
foldmethodIsManual(win_T *wp)
|
||||
{
|
||||
return (wp->w_p_fdm[3] == 'u');
|
||||
}
|
||||
@@ -326,8 +313,7 @@ foldmethodIsManual(wp)
|
||||
* Return TRUE if 'foldmethod' is "indent"
|
||||
*/
|
||||
int
|
||||
foldmethodIsIndent(wp)
|
||||
win_T *wp;
|
||||
foldmethodIsIndent(win_T *wp)
|
||||
{
|
||||
return (wp->w_p_fdm[0] == 'i');
|
||||
}
|
||||
@@ -337,8 +323,7 @@ foldmethodIsIndent(wp)
|
||||
* Return TRUE if 'foldmethod' is "expr"
|
||||
*/
|
||||
int
|
||||
foldmethodIsExpr(wp)
|
||||
win_T *wp;
|
||||
foldmethodIsExpr(win_T *wp)
|
||||
{
|
||||
return (wp->w_p_fdm[1] == 'x');
|
||||
}
|
||||
@@ -348,8 +333,7 @@ foldmethodIsExpr(wp)
|
||||
* Return TRUE if 'foldmethod' is "marker"
|
||||
*/
|
||||
int
|
||||
foldmethodIsMarker(wp)
|
||||
win_T *wp;
|
||||
foldmethodIsMarker(win_T *wp)
|
||||
{
|
||||
return (wp->w_p_fdm[2] == 'r');
|
||||
}
|
||||
@@ -359,8 +343,7 @@ foldmethodIsMarker(wp)
|
||||
* Return TRUE if 'foldmethod' is "syntax"
|
||||
*/
|
||||
int
|
||||
foldmethodIsSyntax(wp)
|
||||
win_T *wp;
|
||||
foldmethodIsSyntax(win_T *wp)
|
||||
{
|
||||
return (wp->w_p_fdm[0] == 's');
|
||||
}
|
||||
@@ -370,8 +353,7 @@ foldmethodIsSyntax(wp)
|
||||
* Return TRUE if 'foldmethod' is "diff"
|
||||
*/
|
||||
int
|
||||
foldmethodIsDiff(wp)
|
||||
win_T *wp;
|
||||
foldmethodIsDiff(win_T *wp)
|
||||
{
|
||||
return (wp->w_p_fdm[0] == 'd');
|
||||
}
|
||||
@@ -382,9 +364,7 @@ foldmethodIsDiff(wp)
|
||||
* Repeat "count" times.
|
||||
*/
|
||||
void
|
||||
closeFold(lnum, count)
|
||||
linenr_T lnum;
|
||||
long count;
|
||||
closeFold(linenr_T lnum, long count)
|
||||
{
|
||||
setFoldRepeat(lnum, count, FALSE);
|
||||
}
|
||||
@@ -394,8 +374,7 @@ closeFold(lnum, count)
|
||||
* Close fold for current window at line "lnum" recursively.
|
||||
*/
|
||||
void
|
||||
closeFoldRecurse(lnum)
|
||||
linenr_T lnum;
|
||||
closeFoldRecurse(linenr_T lnum)
|
||||
{
|
||||
(void)setManualFold(lnum, FALSE, TRUE, NULL);
|
||||
}
|
||||
@@ -406,12 +385,12 @@ closeFoldRecurse(lnum)
|
||||
* Used for "zo", "zO", "zc" and "zC" in Visual mode.
|
||||
*/
|
||||
void
|
||||
opFoldRange(first, last, opening, recurse, had_visual)
|
||||
linenr_T first;
|
||||
linenr_T last;
|
||||
int opening; /* TRUE to open, FALSE to close */
|
||||
int recurse; /* TRUE to do it recursively */
|
||||
int had_visual; /* TRUE when Visual selection used */
|
||||
opFoldRange(
|
||||
linenr_T first,
|
||||
linenr_T last,
|
||||
int opening, /* TRUE to open, FALSE to close */
|
||||
int recurse, /* TRUE to do it recursively */
|
||||
int had_visual) /* TRUE when Visual selection used */
|
||||
{
|
||||
int done = DONE_NOTHING; /* avoid error messages */
|
||||
linenr_T lnum;
|
||||
@@ -443,9 +422,7 @@ opFoldRange(first, last, opening, recurse, had_visual)
|
||||
* Repeat "count" times.
|
||||
*/
|
||||
void
|
||||
openFold(lnum, count)
|
||||
linenr_T lnum;
|
||||
long count;
|
||||
openFold(linenr_T lnum, long count)
|
||||
{
|
||||
setFoldRepeat(lnum, count, TRUE);
|
||||
}
|
||||
@@ -455,8 +432,7 @@ openFold(lnum, count)
|
||||
* Open fold for current window at line "lnum" recursively.
|
||||
*/
|
||||
void
|
||||
openFoldRecurse(lnum)
|
||||
linenr_T lnum;
|
||||
openFoldRecurse(linenr_T lnum)
|
||||
{
|
||||
(void)setManualFold(lnum, TRUE, TRUE, NULL);
|
||||
}
|
||||
@@ -466,7 +442,7 @@ openFoldRecurse(lnum)
|
||||
* Open folds until the cursor line is not in a closed fold.
|
||||
*/
|
||||
void
|
||||
foldOpenCursor()
|
||||
foldOpenCursor(void)
|
||||
{
|
||||
int done;
|
||||
|
||||
@@ -486,7 +462,7 @@ foldOpenCursor()
|
||||
* Set new foldlevel for current window.
|
||||
*/
|
||||
void
|
||||
newFoldLevel()
|
||||
newFoldLevel(void)
|
||||
{
|
||||
newFoldLevelWin(curwin);
|
||||
|
||||
@@ -511,8 +487,7 @@ newFoldLevel()
|
||||
}
|
||||
|
||||
static void
|
||||
newFoldLevelWin(wp)
|
||||
win_T *wp;
|
||||
newFoldLevelWin(win_T *wp)
|
||||
{
|
||||
fold_T *fp;
|
||||
int i;
|
||||
@@ -536,7 +511,7 @@ newFoldLevelWin(wp)
|
||||
* Apply 'foldlevel' to all folds that don't contain the cursor.
|
||||
*/
|
||||
void
|
||||
foldCheckClose()
|
||||
foldCheckClose(void)
|
||||
{
|
||||
if (*p_fcl != NUL) /* can only be "all" right now */
|
||||
{
|
||||
@@ -549,10 +524,7 @@ foldCheckClose()
|
||||
|
||||
/* checkCloseRec() {{{2 */
|
||||
static int
|
||||
checkCloseRec(gap, lnum, level)
|
||||
garray_T *gap;
|
||||
linenr_T lnum;
|
||||
int level;
|
||||
checkCloseRec(garray_T *gap, linenr_T lnum, int level)
|
||||
{
|
||||
fold_T *fp;
|
||||
int retval = FALSE;
|
||||
@@ -584,8 +556,7 @@ checkCloseRec(gap, lnum, level)
|
||||
* Give an error message and return FALSE if not.
|
||||
*/
|
||||
int
|
||||
foldManualAllowed(create)
|
||||
int create;
|
||||
foldManualAllowed(int create)
|
||||
{
|
||||
if (foldmethodIsManual(curwin) || foldmethodIsMarker(curwin))
|
||||
return TRUE;
|
||||
@@ -602,9 +573,7 @@ foldManualAllowed(create)
|
||||
* window.
|
||||
*/
|
||||
void
|
||||
foldCreate(start, end)
|
||||
linenr_T start;
|
||||
linenr_T end;
|
||||
foldCreate(linenr_T start, linenr_T end)
|
||||
{
|
||||
fold_T *fp;
|
||||
garray_T *gap;
|
||||
@@ -729,11 +698,11 @@ foldCreate(start, end)
|
||||
* When "recursive" is TRUE delete recursively.
|
||||
*/
|
||||
void
|
||||
deleteFold(start, end, recursive, had_visual)
|
||||
linenr_T start;
|
||||
linenr_T end;
|
||||
int recursive;
|
||||
int had_visual; /* TRUE when Visual selection used */
|
||||
deleteFold(
|
||||
linenr_T start,
|
||||
linenr_T end,
|
||||
int recursive,
|
||||
int had_visual) /* TRUE when Visual selection used */
|
||||
{
|
||||
garray_T *gap;
|
||||
fold_T *fp;
|
||||
@@ -824,8 +793,7 @@ deleteFold(start, end, recursive, had_visual)
|
||||
* Remove all folding for window "win".
|
||||
*/
|
||||
void
|
||||
clearFolding(win)
|
||||
win_T *win;
|
||||
clearFolding(win_T *win)
|
||||
{
|
||||
deleteFoldRecurse(&win->w_folds);
|
||||
win->w_foldinvalid = FALSE;
|
||||
@@ -839,10 +807,7 @@ clearFolding(win)
|
||||
* The changes in lines from top to bot (inclusive).
|
||||
*/
|
||||
void
|
||||
foldUpdate(wp, top, bot)
|
||||
win_T *wp;
|
||||
linenr_T top;
|
||||
linenr_T bot;
|
||||
foldUpdate(win_T *wp, linenr_T top, linenr_T bot)
|
||||
{
|
||||
fold_T *fp;
|
||||
|
||||
@@ -880,8 +845,7 @@ foldUpdate(wp, top, bot)
|
||||
* every time a setting is changed or a syntax item is added.
|
||||
*/
|
||||
void
|
||||
foldUpdateAll(win)
|
||||
win_T *win;
|
||||
foldUpdateAll(win_T *win)
|
||||
{
|
||||
win->w_foldinvalid = TRUE;
|
||||
redraw_win_later(win, NOT_VALID);
|
||||
@@ -894,10 +858,10 @@ foldUpdateAll(win)
|
||||
* If not moved return FAIL.
|
||||
*/
|
||||
int
|
||||
foldMoveTo(updown, dir, count)
|
||||
int updown;
|
||||
int dir; /* FORWARD or BACKWARD */
|
||||
long count;
|
||||
foldMoveTo(
|
||||
int updown,
|
||||
int dir, /* FORWARD or BACKWARD */
|
||||
long count)
|
||||
{
|
||||
long n;
|
||||
int retval = FAIL;
|
||||
@@ -1031,8 +995,7 @@ foldMoveTo(updown, dir, count)
|
||||
* Init the fold info in a new window.
|
||||
*/
|
||||
void
|
||||
foldInitWin(new_win)
|
||||
win_T *new_win;
|
||||
foldInitWin(win_T *new_win)
|
||||
{
|
||||
ga_init2(&new_win->w_folds, (int)sizeof(fold_T), 10);
|
||||
}
|
||||
@@ -1045,9 +1008,7 @@ foldInitWin(new_win)
|
||||
* Returns index of entry or -1 if not found.
|
||||
*/
|
||||
int
|
||||
find_wl_entry(win, lnum)
|
||||
win_T *win;
|
||||
linenr_T lnum;
|
||||
find_wl_entry(win_T *win, linenr_T lnum)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1067,7 +1028,7 @@ find_wl_entry(win, lnum)
|
||||
* Adjust the Visual area to include any fold at the start or end completely.
|
||||
*/
|
||||
void
|
||||
foldAdjustVisual()
|
||||
foldAdjustVisual(void)
|
||||
{
|
||||
pos_T *start, *end;
|
||||
char_u *ptr;
|
||||
@@ -1106,7 +1067,7 @@ foldAdjustVisual()
|
||||
* Move the cursor to the first line of a closed fold.
|
||||
*/
|
||||
void
|
||||
foldAdjustCursor()
|
||||
foldAdjustCursor(void)
|
||||
{
|
||||
(void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL);
|
||||
}
|
||||
@@ -1119,9 +1080,7 @@ foldAdjustCursor()
|
||||
* Return FAIL if the operation cannot be completed, otherwise OK.
|
||||
*/
|
||||
void
|
||||
cloneFoldGrowArray(from, to)
|
||||
garray_T *from;
|
||||
garray_T *to;
|
||||
cloneFoldGrowArray(garray_T *from, garray_T *to)
|
||||
{
|
||||
int i;
|
||||
fold_T *from_p;
|
||||
@@ -1155,10 +1114,7 @@ cloneFoldGrowArray(from, to)
|
||||
* Returns FALSE when there is no fold that contains "lnum".
|
||||
*/
|
||||
static int
|
||||
foldFind(gap, lnum, fpp)
|
||||
garray_T *gap;
|
||||
linenr_T lnum;
|
||||
fold_T **fpp;
|
||||
foldFind(garray_T *gap, linenr_T lnum, fold_T **fpp)
|
||||
{
|
||||
linenr_T low, high;
|
||||
fold_T *fp;
|
||||
@@ -1197,9 +1153,7 @@ foldFind(gap, lnum, fpp)
|
||||
* Return fold level at line number "lnum" in window "wp".
|
||||
*/
|
||||
static int
|
||||
foldLevelWin(wp, lnum)
|
||||
win_T *wp;
|
||||
linenr_T lnum;
|
||||
foldLevelWin(win_T *wp, linenr_T lnum)
|
||||
{
|
||||
fold_T *fp;
|
||||
linenr_T lnum_rel = lnum;
|
||||
@@ -1226,8 +1180,7 @@ foldLevelWin(wp, lnum)
|
||||
* Check if the folds in window "wp" are invalid and update them if needed.
|
||||
*/
|
||||
static void
|
||||
checkupdate(wp)
|
||||
win_T *wp;
|
||||
checkupdate(win_T *wp)
|
||||
{
|
||||
if (wp->w_foldinvalid)
|
||||
{
|
||||
@@ -1242,10 +1195,7 @@ checkupdate(wp)
|
||||
* Repeat "count" times.
|
||||
*/
|
||||
static void
|
||||
setFoldRepeat(lnum, count, do_open)
|
||||
linenr_T lnum;
|
||||
long count;
|
||||
int do_open;
|
||||
setFoldRepeat(linenr_T lnum, long count, int do_open)
|
||||
{
|
||||
int done;
|
||||
long n;
|
||||
@@ -1270,11 +1220,11 @@ setFoldRepeat(lnum, count, do_open)
|
||||
* Also does this for other windows in diff mode when needed.
|
||||
*/
|
||||
static linenr_T
|
||||
setManualFold(lnum, opening, recurse, donep)
|
||||
linenr_T lnum;
|
||||
int opening; /* TRUE when opening, FALSE when closing */
|
||||
int recurse; /* TRUE when closing/opening recursive */
|
||||
int *donep;
|
||||
setManualFold(
|
||||
linenr_T lnum,
|
||||
int opening, /* TRUE when opening, FALSE when closing */
|
||||
int recurse, /* TRUE when closing/opening recursive */
|
||||
int *donep)
|
||||
{
|
||||
#ifdef FEAT_DIFF
|
||||
if (foldmethodIsDiff(curwin) && curwin->w_p_scb)
|
||||
@@ -1312,12 +1262,12 @@ setManualFold(lnum, opening, recurse, donep)
|
||||
* It's only valid when "opening" is TRUE!
|
||||
*/
|
||||
static linenr_T
|
||||
setManualFoldWin(wp, lnum, opening, recurse, donep)
|
||||
win_T *wp;
|
||||
linenr_T lnum;
|
||||
int opening; /* TRUE when opening, FALSE when closing */
|
||||
int recurse; /* TRUE when closing/opening recursive */
|
||||
int *donep;
|
||||
setManualFoldWin(
|
||||
win_T *wp,
|
||||
linenr_T lnum,
|
||||
int opening, /* TRUE when opening, FALSE when closing */
|
||||
int recurse, /* TRUE when closing/opening recursive */
|
||||
int *donep)
|
||||
{
|
||||
fold_T *fp;
|
||||
fold_T *fp2;
|
||||
@@ -1423,8 +1373,7 @@ setManualFoldWin(wp, lnum, opening, recurse, donep)
|
||||
* Open all nested folds in fold "fpr" recursively.
|
||||
*/
|
||||
static void
|
||||
foldOpenNested(fpr)
|
||||
fold_T *fpr;
|
||||
foldOpenNested(fold_T *fpr)
|
||||
{
|
||||
int i;
|
||||
fold_T *fp;
|
||||
@@ -1444,10 +1393,7 @@ foldOpenNested(fpr)
|
||||
* When "recursive" is FALSE contained folds are moved one level up.
|
||||
*/
|
||||
static void
|
||||
deleteFoldEntry(gap, idx, recursive)
|
||||
garray_T *gap;
|
||||
int idx;
|
||||
int recursive;
|
||||
deleteFoldEntry(garray_T *gap, int idx, int recursive)
|
||||
{
|
||||
fold_T *fp;
|
||||
int i;
|
||||
@@ -1501,8 +1447,7 @@ deleteFoldEntry(gap, idx, recursive)
|
||||
* Delete nested folds in a fold.
|
||||
*/
|
||||
void
|
||||
deleteFoldRecurse(gap)
|
||||
garray_T *gap;
|
||||
deleteFoldRecurse(garray_T *gap)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1516,12 +1461,12 @@ deleteFoldRecurse(gap)
|
||||
* Update line numbers of folds for inserted/deleted lines.
|
||||
*/
|
||||
void
|
||||
foldMarkAdjust(wp, line1, line2, amount, amount_after)
|
||||
win_T *wp;
|
||||
linenr_T line1;
|
||||
linenr_T line2;
|
||||
long amount;
|
||||
long amount_after;
|
||||
foldMarkAdjust(
|
||||
win_T *wp,
|
||||
linenr_T line1,
|
||||
linenr_T line2,
|
||||
long amount,
|
||||
long amount_after)
|
||||
{
|
||||
/* If deleting marks from line1 to line2, but not deleting all those
|
||||
* lines, set line2 so that only deleted lines have their folds removed. */
|
||||
@@ -1536,12 +1481,12 @@ foldMarkAdjust(wp, line1, line2, amount, amount_after)
|
||||
|
||||
/* foldMarkAdjustRecurse() {{{2 */
|
||||
static void
|
||||
foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after)
|
||||
garray_T *gap;
|
||||
linenr_T line1;
|
||||
linenr_T line2;
|
||||
long amount;
|
||||
long amount_after;
|
||||
foldMarkAdjustRecurse(
|
||||
garray_T *gap,
|
||||
linenr_T line1,
|
||||
linenr_T line2,
|
||||
long amount,
|
||||
long amount_after)
|
||||
{
|
||||
fold_T *fp;
|
||||
int i;
|
||||
@@ -1653,15 +1598,14 @@ foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after)
|
||||
* current window open.
|
||||
*/
|
||||
int
|
||||
getDeepestNesting()
|
||||
getDeepestNesting(void)
|
||||
{
|
||||
checkupdate(curwin);
|
||||
return getDeepestNestingRecurse(&curwin->w_folds);
|
||||
}
|
||||
|
||||
static int
|
||||
getDeepestNestingRecurse(gap)
|
||||
garray_T *gap;
|
||||
getDeepestNestingRecurse(garray_T *gap)
|
||||
{
|
||||
int i;
|
||||
int level;
|
||||
@@ -1684,13 +1628,13 @@ getDeepestNestingRecurse(gap)
|
||||
* Check if a fold is closed and update the info needed to check nested folds.
|
||||
*/
|
||||
static int
|
||||
check_closed(win, fp, use_levelp, level, maybe_smallp, lnum_off)
|
||||
win_T *win;
|
||||
fold_T *fp;
|
||||
int *use_levelp; /* TRUE: outer fold had FD_LEVEL */
|
||||
int level; /* folding depth */
|
||||
int *maybe_smallp; /* TRUE: outer this had fd_small == MAYBE */
|
||||
linenr_T lnum_off; /* line number offset for fp->fd_top */
|
||||
check_closed(
|
||||
win_T *win,
|
||||
fold_T *fp,
|
||||
int *use_levelp, /* TRUE: outer fold had FD_LEVEL */
|
||||
int level, /* folding depth */
|
||||
int *maybe_smallp, /* TRUE: outer this had fd_small == MAYBE */
|
||||
linenr_T lnum_off) /* line number offset for fp->fd_top */
|
||||
{
|
||||
int closed = FALSE;
|
||||
|
||||
@@ -1724,10 +1668,10 @@ check_closed(win, fp, use_levelp, level, maybe_smallp, lnum_off)
|
||||
* Update fd_small field of fold "fp".
|
||||
*/
|
||||
static void
|
||||
checkSmall(wp, fp, lnum_off)
|
||||
win_T *wp;
|
||||
fold_T *fp;
|
||||
linenr_T lnum_off; /* offset for fp->fd_top */
|
||||
checkSmall(
|
||||
win_T *wp,
|
||||
fold_T *fp,
|
||||
linenr_T lnum_off) /* offset for fp->fd_top */
|
||||
{
|
||||
int count;
|
||||
int n;
|
||||
@@ -1761,8 +1705,7 @@ checkSmall(wp, fp, lnum_off)
|
||||
* Set small flags in "gap" to MAYBE.
|
||||
*/
|
||||
static void
|
||||
setSmallMaybe(gap)
|
||||
garray_T *gap;
|
||||
setSmallMaybe(garray_T *gap)
|
||||
{
|
||||
int i;
|
||||
fold_T *fp;
|
||||
@@ -1778,9 +1721,7 @@ setSmallMaybe(gap)
|
||||
* window by adding markers.
|
||||
*/
|
||||
static void
|
||||
foldCreateMarkers(start, end)
|
||||
linenr_T start;
|
||||
linenr_T end;
|
||||
foldCreateMarkers(linenr_T start, linenr_T end)
|
||||
{
|
||||
if (!curbuf->b_p_ma)
|
||||
{
|
||||
@@ -1802,10 +1743,7 @@ foldCreateMarkers(start, end)
|
||||
* Add "marker[markerlen]" in 'commentstring' to line "lnum".
|
||||
*/
|
||||
static void
|
||||
foldAddMarker(lnum, marker, markerlen)
|
||||
linenr_T lnum;
|
||||
char_u *marker;
|
||||
int markerlen;
|
||||
foldAddMarker(linenr_T lnum, char_u *marker, int markerlen)
|
||||
{
|
||||
char_u *cms = curbuf->b_p_cms;
|
||||
char_u *line;
|
||||
@@ -1841,10 +1779,10 @@ foldAddMarker(lnum, marker, markerlen)
|
||||
* Delete the markers for a fold, causing it to be deleted.
|
||||
*/
|
||||
static void
|
||||
deleteFoldMarkers(fp, recursive, lnum_off)
|
||||
fold_T *fp;
|
||||
int recursive;
|
||||
linenr_T lnum_off; /* offset for fp->fd_top */
|
||||
deleteFoldMarkers(
|
||||
fold_T *fp,
|
||||
int recursive,
|
||||
linenr_T lnum_off) /* offset for fp->fd_top */
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1865,10 +1803,7 @@ deleteFoldMarkers(fp, recursive, lnum_off)
|
||||
* close-marker.
|
||||
*/
|
||||
static void
|
||||
foldDelMarker(lnum, marker, markerlen)
|
||||
linenr_T lnum;
|
||||
char_u *marker;
|
||||
int markerlen;
|
||||
foldDelMarker(linenr_T lnum, char_u *marker, int markerlen)
|
||||
{
|
||||
char_u *line;
|
||||
char_u *newline;
|
||||
@@ -1919,11 +1854,12 @@ foldDelMarker(lnum, marker, markerlen)
|
||||
* result is in allocated memory.
|
||||
*/
|
||||
char_u *
|
||||
get_foldtext(wp, lnum, lnume, foldinfo, buf)
|
||||
win_T *wp;
|
||||
linenr_T lnum, lnume;
|
||||
foldinfo_T *foldinfo;
|
||||
char_u *buf;
|
||||
get_foldtext(
|
||||
win_T *wp,
|
||||
linenr_T lnum,
|
||||
linenr_T lnume,
|
||||
foldinfo_T *foldinfo,
|
||||
char_u *buf)
|
||||
{
|
||||
char_u *text = NULL;
|
||||
#ifdef FEAT_EVAL
|
||||
@@ -2033,8 +1969,7 @@ get_foldtext(wp, lnum, lnume, foldinfo, buf)
|
||||
* Remove 'foldmarker' and 'commentstring' from "str" (in-place).
|
||||
*/
|
||||
void
|
||||
foldtext_cleanup(str)
|
||||
char_u *str;
|
||||
foldtext_cleanup(char_u *str)
|
||||
{
|
||||
char_u *cms_start; /* first part or the whole comment */
|
||||
int cms_slen = 0; /* length of cms_start */
|
||||
@@ -2161,10 +2096,7 @@ static void foldlevelSyntax(fline_T *flp);
|
||||
* Return TRUE if any folds did change.
|
||||
*/
|
||||
static void
|
||||
foldUpdateIEMS(wp, top, bot)
|
||||
win_T *wp;
|
||||
linenr_T top;
|
||||
linenr_T bot;
|
||||
foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot)
|
||||
{
|
||||
linenr_T start;
|
||||
linenr_T end;
|
||||
@@ -2417,14 +2349,14 @@ foldUpdateIEMS(wp, top, bot)
|
||||
* updated as a result of a detected change in the fold.
|
||||
*/
|
||||
static linenr_T
|
||||
foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags)
|
||||
garray_T *gap;
|
||||
int level;
|
||||
linenr_T startlnum;
|
||||
fline_T *flp;
|
||||
void (*getlevel)(fline_T *);
|
||||
linenr_T bot;
|
||||
int topflags; /* flags used by containing fold */
|
||||
foldUpdateIEMSRecurse(
|
||||
garray_T *gap,
|
||||
int level,
|
||||
linenr_T startlnum,
|
||||
fline_T *flp,
|
||||
void (*getlevel)(fline_T *),
|
||||
linenr_T bot,
|
||||
int topflags) /* flags used by containing fold */
|
||||
{
|
||||
linenr_T ll;
|
||||
fold_T *fp = NULL;
|
||||
@@ -2831,9 +2763,7 @@ foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags)
|
||||
* Returns OK for success, FAIL for failure.
|
||||
*/
|
||||
static int
|
||||
foldInsert(gap, i)
|
||||
garray_T *gap;
|
||||
int i;
|
||||
foldInsert(garray_T *gap, int i)
|
||||
{
|
||||
fold_T *fp;
|
||||
|
||||
@@ -2856,11 +2786,11 @@ foldInsert(gap, i)
|
||||
* "bot"!
|
||||
*/
|
||||
static void
|
||||
foldSplit(gap, i, top, bot)
|
||||
garray_T *gap;
|
||||
int i;
|
||||
linenr_T top;
|
||||
linenr_T bot;
|
||||
foldSplit(
|
||||
garray_T *gap,
|
||||
int i,
|
||||
linenr_T top,
|
||||
linenr_T bot)
|
||||
{
|
||||
fold_T *fp;
|
||||
fold_T *fp2;
|
||||
@@ -2920,10 +2850,7 @@ foldSplit(gap, i, top, bot)
|
||||
* 6: not changed
|
||||
*/
|
||||
static void
|
||||
foldRemove(gap, top, bot)
|
||||
garray_T *gap;
|
||||
linenr_T top;
|
||||
linenr_T bot;
|
||||
foldRemove(garray_T *gap, linenr_T top, linenr_T bot)
|
||||
{
|
||||
fold_T *fp = NULL;
|
||||
|
||||
@@ -2986,10 +2913,7 @@ foldRemove(gap, top, bot)
|
||||
* Fold entry "fp2" in "gap" is deleted.
|
||||
*/
|
||||
static void
|
||||
foldMerge(fp1, gap, fp2)
|
||||
fold_T *fp1;
|
||||
garray_T *gap;
|
||||
fold_T *fp2;
|
||||
foldMerge(fold_T *fp1, garray_T *gap, fold_T *fp2)
|
||||
{
|
||||
fold_T *fp3;
|
||||
fold_T *fp4;
|
||||
@@ -3027,8 +2951,7 @@ foldMerge(fp1, gap, fp2)
|
||||
* Returns a level of -1 if the foldlevel depends on surrounding lines.
|
||||
*/
|
||||
static void
|
||||
foldlevelIndent(flp)
|
||||
fline_T *flp;
|
||||
foldlevelIndent(fline_T *flp)
|
||||
{
|
||||
char_u *s;
|
||||
buf_T *buf;
|
||||
@@ -3064,8 +2987,7 @@ foldlevelIndent(flp)
|
||||
* Doesn't use any caching.
|
||||
*/
|
||||
static void
|
||||
foldlevelDiff(flp)
|
||||
fline_T *flp;
|
||||
foldlevelDiff(fline_T *flp)
|
||||
{
|
||||
if (diff_infold(flp->wp, flp->lnum + flp->off))
|
||||
flp->lvl = 1;
|
||||
@@ -3081,8 +3003,7 @@ foldlevelDiff(flp)
|
||||
* Returns a level of -1 if the foldlevel depends on surrounding lines.
|
||||
*/
|
||||
static void
|
||||
foldlevelExpr(flp)
|
||||
fline_T *flp;
|
||||
foldlevelExpr(fline_T *flp)
|
||||
{
|
||||
#ifndef FEAT_EVAL
|
||||
flp->start = FALSE;
|
||||
@@ -3184,8 +3105,7 @@ foldlevelExpr(flp)
|
||||
* Relies on the option value to have been checked for correctness already.
|
||||
*/
|
||||
static void
|
||||
parseMarker(wp)
|
||||
win_T *wp;
|
||||
parseMarker(win_T *wp)
|
||||
{
|
||||
foldendmarker = vim_strchr(wp->w_p_fmr, ',');
|
||||
foldstartmarkerlen = (int)(foldendmarker++ - wp->w_p_fmr);
|
||||
@@ -3203,8 +3123,7 @@ parseMarker(wp)
|
||||
* Sets flp->start when a start marker was found.
|
||||
*/
|
||||
static void
|
||||
foldlevelMarker(flp)
|
||||
fline_T *flp;
|
||||
foldlevelMarker(fline_T *flp)
|
||||
{
|
||||
char_u *startmarker;
|
||||
int cstart;
|
||||
@@ -3286,8 +3205,7 @@ foldlevelMarker(flp)
|
||||
* Doesn't use any caching.
|
||||
*/
|
||||
static void
|
||||
foldlevelSyntax(flp)
|
||||
fline_T *flp;
|
||||
foldlevelSyntax(fline_T *flp)
|
||||
{
|
||||
#ifndef FEAT_SYN_HL
|
||||
flp->start = 0;
|
||||
@@ -3323,9 +3241,7 @@ static int put_fold_open_close(FILE *fd, fold_T *fp, linenr_T off);
|
||||
* Return FAIL if writing fails.
|
||||
*/
|
||||
int
|
||||
put_folds(fd, wp)
|
||||
FILE *fd;
|
||||
win_T *wp;
|
||||
put_folds(FILE *fd, win_T *wp)
|
||||
{
|
||||
if (foldmethodIsManual(wp))
|
||||
{
|
||||
@@ -3347,10 +3263,7 @@ put_folds(fd, wp)
|
||||
* Returns FAIL when writing failed.
|
||||
*/
|
||||
static int
|
||||
put_folds_recurse(fd, gap, off)
|
||||
FILE *fd;
|
||||
garray_T *gap;
|
||||
linenr_T off;
|
||||
put_folds_recurse(FILE *fd, garray_T *gap, linenr_T off)
|
||||
{
|
||||
int i;
|
||||
fold_T *fp;
|
||||
@@ -3376,11 +3289,11 @@ put_folds_recurse(fd, gap, off)
|
||||
* Returns FAIL when writing failed.
|
||||
*/
|
||||
static int
|
||||
put_foldopen_recurse(fd, wp, gap, off)
|
||||
FILE *fd;
|
||||
win_T *wp;
|
||||
garray_T *gap;
|
||||
linenr_T off;
|
||||
put_foldopen_recurse(
|
||||
FILE *fd,
|
||||
win_T *wp,
|
||||
garray_T *gap,
|
||||
linenr_T off)
|
||||
{
|
||||
int i;
|
||||
int level;
|
||||
@@ -3433,10 +3346,7 @@ put_foldopen_recurse(fd, wp, gap, off)
|
||||
* Returns FAIL when writing failed.
|
||||
*/
|
||||
static int
|
||||
put_fold_open_close(fd, fp, off)
|
||||
FILE *fd;
|
||||
fold_T *fp;
|
||||
linenr_T off;
|
||||
put_fold_open_close(FILE *fd, fold_T *fp, linenr_T off)
|
||||
{
|
||||
if (fprintf(fd, "%ld", fp->fd_top + off) < 0
|
||||
|| put_eol(fd) == FAIL
|
||||
|
Reference in New Issue
Block a user