[][src]Module nvimpam_lib::folds

This module provides the FoldList struct to manage folds in a buffer. It carries both level 1 folds as well as level 2 folds (i.e. folds that contain folds of level 1). All functions that insert/remove/modify folds operate on level 1 folds, the only thing to be done for the level 2 folds is regenerating them in full from the level 1 folds.

Example usage:

let mut foldlist = FoldList::new();
foldlist
  .checked_insert(1, 2, Keyword::Node)
  .map_err(|e| println!("{}", e));
assert!(foldlist.remove(2, 3).is_err());
assert!(foldlist.remove(1, 2).is_ok());

Structs

FoldList

Holds the fold data of the buffer. A fold has the following data: Linenumbers start, end (indexed from 0), and a Keyword.