Data Structures | Macros | Typedefs | Functions
fold.c File Reference
#include <string.h>
#include <inttypes.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/fold.h"
#include "nvim/change.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/diff.h"
#include "nvim/eval.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_session.h"
#include "nvim/func_attr.h"
#include "nvim/indent.h"
#include "nvim/buffer_updates.h"
#include "nvim/extmark.h"
#include "nvim/mark.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
#include "nvim/garray.h"
#include "nvim/move.h"
#include "nvim/option.h"
#include "nvim/screen.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/undo.h"
#include "nvim/ops.h"

Data Structures

struct  fold_T
struct  fline_T


#define FD_OPEN   0 /* fold is open (nested ones can be closed) */
#define FD_CLOSED   1 /* fold is closed */
#define FD_LEVEL   2 /* depends on 'foldlevel' (nested folds too) */
#define MAX_LEVEL   20 /* maximum fold depth */
#define DONE_NOTHING   0
#define DONE_ACTION   1 /* did close or open a fold */
#define DONE_FOLD   2 /* did find a fold */
#define DELETE_FOLD_NESTED(fd)   deleteFoldRecurse(&((fd)->fd_nested))
#define FOLD_END(fp)   ((fp)->fd_top + (fp)->fd_len - 1)
#define VALID_FOLD(fp, gap)   ((fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len))
#define FOLD_INDEX(fp, gap)   ((size_t)(fp - ((fold_T *)(gap)->ga_data)))


typedef void(* LevelGetter) (fline_T *)


void copyFoldingState (win_T *wp_from, win_T *wp_to)
int hasAnyFolding (win_T *win)
bool hasFolding (linenr_T lnum, linenr_T *firstp, linenr_T *lastp)
bool hasFoldingWin (win_T *const win, const linenr_T lnum, linenr_T *const firstp, linenr_T *const lastp, const bool cache, foldinfo_T *const infop)
int foldLevel (linenr_T lnum)
bool lineFolded (win_T *const win, const linenr_T lnum)
long foldedCount (win_T *win, linenr_T lnum, foldinfo_T *infop)
int foldmethodIsManual (win_T *wp)
int foldmethodIsIndent (win_T *wp)
int foldmethodIsExpr (win_T *wp)
int foldmethodIsMarker (win_T *wp)
int foldmethodIsSyntax (win_T *wp)
int foldmethodIsDiff (win_T *wp)
void closeFold (linenr_T lnum, long count)
void closeFoldRecurse (linenr_T lnum)
void opFoldRange (linenr_T first, linenr_T last, int opening, int recurse, int had_visual)
void openFold (linenr_T lnum, long count)
void openFoldRecurse (linenr_T lnum)
void foldOpenCursor (void)
void newFoldLevel (void)
void foldCheckClose (void)
int foldManualAllowed (int create)
void foldCreate (linenr_T start, linenr_T end)
void deleteFold (const linenr_T start, const linenr_T end, const int recursive, const bool had_visual)
void clearFolding (win_T *win)
void foldUpdate (win_T *wp, linenr_T top, linenr_T bot)
void foldUpdateAfterInsert (void)
 Updates folds when leaving insert-mode. More...
void foldUpdateAll (win_T *win)
int foldMoveTo (const bool updown, const int dir, const long count)
void foldInitWin (win_T *new_win)
int find_wl_entry (win_T *win, linenr_T lnum)
void foldAdjustVisual (void)
void foldAdjustCursor (void)
void cloneFoldGrowArray (garray_T *from, garray_T *to)
void deleteFoldRecurse (garray_T *gap)
void foldMarkAdjust (win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after)
int getDeepestNesting (void)
char_uget_foldtext (win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T *foldinfo, char_u *buf) FUNC_ATTR_NONNULL_ARG(1)
void foldtext_cleanup (char_u *str)
void foldMoveRange (garray_T *gap, const linenr_T line1, const linenr_T line2, const linenr_T dest)
int put_folds (FILE *fd, win_T *wp)

Macro Definition Documentation

#define DELETE_FOLD_NESTED (   fd)    deleteFoldRecurse(&((fd)->fd_nested))
#define DONE_ACTION   1 /* did close or open a fold */
#define DONE_FOLD   2 /* did find a fold */
#define DONE_NOTHING   0
#define FD_CLOSED   1 /* fold is closed */
#define FD_LEVEL   2 /* depends on 'foldlevel' (nested folds too) */
#define FD_OPEN   0 /* fold is open (nested ones can be closed) */
#define FOLD_END (   fp)    ((fp)->fd_top + (fp)->fd_len - 1)
#define FOLD_INDEX (   fp,
)    ((size_t)(fp - ((fold_T *)(gap)->ga_data)))
#define MAX_LEVEL   20 /* maximum fold depth */
#define VALID_FOLD (   fp,
)    ((fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len))

Typedef Documentation

typedef void(* LevelGetter) (fline_T *)

Function Documentation

void clearFolding ( win_T win)
void cloneFoldGrowArray ( garray_T from,
garray_T to 
void closeFold ( linenr_T  lnum,
long  count 
void closeFoldRecurse ( linenr_T  lnum)
void copyFoldingState ( win_T wp_from,
win_T wp_to 
void deleteFold ( const linenr_T  start,
const linenr_T  end,
const int  recursive,
const bool  had_visual 
void deleteFoldRecurse ( garray_T gap)
int find_wl_entry ( win_T win,
linenr_T  lnum 
void foldAdjustCursor ( void  )
void foldAdjustVisual ( void  )
void foldCheckClose ( void  )
void foldCreate ( linenr_T  start,
linenr_T  end 
long foldedCount ( win_T win,
linenr_T  lnum,
foldinfo_T infop 
void foldInitWin ( win_T new_win)
int foldLevel ( linenr_T  lnum)
int foldManualAllowed ( int  create)
void foldMarkAdjust ( win_T wp,
linenr_T  line1,
linenr_T  line2,
long  amount,
long  amount_after 
int foldmethodIsDiff ( win_T wp)
int foldmethodIsExpr ( win_T wp)
int foldmethodIsIndent ( win_T wp)
int foldmethodIsManual ( win_T wp)
int foldmethodIsMarker ( win_T wp)
int foldmethodIsSyntax ( win_T wp)
void foldMoveRange ( garray_T gap,
const linenr_T  line1,
const linenr_T  line2,
const linenr_T  dest 
int foldMoveTo ( const bool  updown,
const int  dir,
const long  count 
void foldOpenCursor ( void  )
void foldtext_cleanup ( char_u str)
void foldUpdate ( win_T wp,
linenr_T  top,
linenr_T  bot 
void foldUpdateAfterInsert ( void  )

Updates folds when leaving insert-mode.

void foldUpdateAll ( win_T win)
char_u* get_foldtext ( win_T wp,
linenr_T  lnum,
linenr_T  lnume,
foldinfo_T foldinfo,
char_u buf 

Return the text for a closed fold at line "lnum", with last line "lnume". When 'foldtext' isn't set puts the result in "buf[FOLD_TEXT_LEN]". Otherwise the result is in allocated memory.

int getDeepestNesting ( void  )
int hasAnyFolding ( win_T win)
bool hasFolding ( linenr_T  lnum,
linenr_T firstp,
linenr_T lastp 
bool hasFoldingWin ( win_T *const  win,
const linenr_T  lnum,
linenr_T *const  firstp,
linenr_T *const  lastp,
const bool  cache,
foldinfo_T *const  infop 
bool lineFolded ( win_T *const  win,
const linenr_T  lnum 
void newFoldLevel ( void  )
void openFold ( linenr_T  lnum,
long  count 
void openFoldRecurse ( linenr_T  lnum)
void opFoldRange ( linenr_T  first,
linenr_T  last,
int  opening,
int  recurse,
int  had_visual 
int put_folds ( FILE *  fd,
win_T wp