diff options
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 172 |
1 files changed, 0 insertions, 172 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 648c46592..840b89a0c 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -117,11 +117,6 @@ static void f_fmod(typval_T *argvars, typval_T *rettv); #endif static void f_fnameescape(typval_T *argvars, typval_T *rettv); static void f_fnamemodify(typval_T *argvars, typval_T *rettv); -static void f_foldclosed(typval_T *argvars, typval_T *rettv); -static void f_foldclosedend(typval_T *argvars, typval_T *rettv); -static void f_foldlevel(typval_T *argvars, typval_T *rettv); -static void f_foldtext(typval_T *argvars, typval_T *rettv); -static void f_foldtextresult(typval_T *argvars, typval_T *rettv); static void f_foreground(typval_T *argvars, typval_T *rettv); static void f_funcref(typval_T *argvars, typval_T *rettv); static void f_function(typval_T *argvars, typval_T *rettv); @@ -3642,173 +3637,6 @@ f_fnamemodify(typval_T *argvars, typval_T *rettv) } /* - * "foldclosed()" function - */ - static void -foldclosed_both( - typval_T *argvars UNUSED, - typval_T *rettv, - int end UNUSED) -{ -#ifdef FEAT_FOLDING - linenr_T lnum; - linenr_T first, last; - - lnum = tv_get_lnum(argvars); - if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) - { - if (hasFoldingWin(curwin, lnum, &first, &last, FALSE, NULL)) - { - if (end) - rettv->vval.v_number = (varnumber_T)last; - else - rettv->vval.v_number = (varnumber_T)first; - return; - } - } -#endif - rettv->vval.v_number = -1; -} - -/* - * "foldclosed()" function - */ - static void -f_foldclosed(typval_T *argvars, typval_T *rettv) -{ - foldclosed_both(argvars, rettv, FALSE); -} - -/* - * "foldclosedend()" function - */ - static void -f_foldclosedend(typval_T *argvars, typval_T *rettv) -{ - foldclosed_both(argvars, rettv, TRUE); -} - -/* - * "foldlevel()" function - */ - static void -f_foldlevel(typval_T *argvars UNUSED, typval_T *rettv UNUSED) -{ -#ifdef FEAT_FOLDING - linenr_T lnum; - - lnum = tv_get_lnum(argvars); - if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) - rettv->vval.v_number = foldLevel(lnum); -#endif -} - -/* - * "foldtext()" function - */ - static void -f_foldtext(typval_T *argvars UNUSED, typval_T *rettv) -{ -#ifdef FEAT_FOLDING - linenr_T foldstart; - linenr_T foldend; - char_u *dashes; - linenr_T lnum; - char_u *s; - char_u *r; - int len; - char *txt; - long count; -#endif - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; -#ifdef FEAT_FOLDING - foldstart = (linenr_T)get_vim_var_nr(VV_FOLDSTART); - foldend = (linenr_T)get_vim_var_nr(VV_FOLDEND); - dashes = get_vim_var_str(VV_FOLDDASHES); - if (foldstart > 0 && foldend <= curbuf->b_ml.ml_line_count - && dashes != NULL) - { - /* Find first non-empty line in the fold. */ - for (lnum = foldstart; lnum < foldend; ++lnum) - if (!linewhite(lnum)) - break; - - /* Find interesting text in this line. */ - s = skipwhite(ml_get(lnum)); - /* skip C comment-start */ - if (s[0] == '/' && (s[1] == '*' || s[1] == '/')) - { - s = skipwhite(s + 2); - if (*skipwhite(s) == NUL - && lnum + 1 < (linenr_T)get_vim_var_nr(VV_FOLDEND)) - { - s = skipwhite(ml_get(lnum + 1)); - if (*s == '*') - s = skipwhite(s + 1); - } - } - count = (long)(foldend - foldstart + 1); - txt = NGETTEXT("+-%s%3ld line: ", "+-%s%3ld lines: ", count); - r = alloc(STRLEN(txt) - + STRLEN(dashes) // for %s - + 20 // for %3ld - + STRLEN(s)); // concatenated - if (r != NULL) - { - sprintf((char *)r, txt, dashes, count); - len = (int)STRLEN(r); - STRCAT(r, s); - /* remove 'foldmarker' and 'commentstring' */ - foldtext_cleanup(r + len); - rettv->vval.v_string = r; - } - } -#endif -} - -/* - * "foldtextresult(lnum)" function - */ - static void -f_foldtextresult(typval_T *argvars UNUSED, typval_T *rettv) -{ -#ifdef FEAT_FOLDING - linenr_T lnum; - char_u *text; - char_u buf[FOLD_TEXT_LEN]; - foldinfo_T foldinfo; - int fold_count; - static int entered = FALSE; -#endif - - rettv->v_type = VAR_STRING; - rettv->vval.v_string = NULL; -#ifdef FEAT_FOLDING - if (entered) - return; /* reject recursive use */ - entered = TRUE; - - lnum = tv_get_lnum(argvars); - /* treat illegal types and illegal string values for {lnum} the same */ - if (lnum < 0) - lnum = 0; - fold_count = foldedCount(curwin, lnum, &foldinfo); - if (fold_count > 0) - { - text = get_foldtext(curwin, lnum, lnum + fold_count - 1, - &foldinfo, buf); - if (text == buf) - text = vim_strsave(text); - rettv->vval.v_string = text; - } - - entered = FALSE; -#endif -} - -/* * "foreground()" function */ static void |