#help_index "DolDoc/Cmd Line (Typically)"

U0 CursorRemFile(U8 *filename)
{//Remove ASCII 5 cursor from one file.
    CDoc *doc = DocRead(filename, DOCF_PLAIN_TEXT | DOCF_NO_CURSOR);

    DocWrite(doc);
    DocDel(doc);
}

public U0 CursorRemove(U8 *files_find_mask="*")
{//Remove ASCII 5 cursor.
    I64 fuf_flags = 0;

    FlagsScan(&fuf_flags, Define("ST_FILE_UTIL_FLAGS"), "+r+T+f+F+O");

    CDirEntry *tmpde = FilesFind(files_find_mask, fuf_flags), *tmpde1 = tmpde;

    while (tmpde)
    {
        CursorRemFile(tmpde->full_name);
        Touch(tmpde->full_name, "",, tmpde->datetime);
        tmpde = tmpde->next;
    }
    DirTreeDel(tmpde1);
}

U0 CollapseFile(U8 *filename, Bool collapse=TRUE)
{//Collapse DolDoc trees in one file.
    CDoc *doc = DocRead(filename, DOCF_NO_CURSOR);

    DocCollapse(collapse, doc);
    DocWrite(doc);
    DocDel(doc);
}

public U0 Collapse(U8 *files_find_mask="*", Bool collapse=TRUE, U8 *fu_flags=NULL)
{//Collapse DolDoc trees.
    I64 fuf_flags = 0;

    FlagsScan(&fuf_flags, Define("ST_FILE_UTIL_FLAGS"), "+r+f+F+$+O");
    FlagsScan(&fuf_flags, Define("ST_FILE_UTIL_FLAGS"), fu_flags);

    CDirEntry *tmpde = FilesFind(files_find_mask, fuf_flags), *tmpde1 = tmpde;

    while (tmpde && !Bt(&fuf_flags, FUf_CANCEL))
    {
        CollapseFile(tmpde->full_name, collapse);
        Touch(tmpde->full_name, "",, tmpde->datetime);
        tmpde = tmpde->next;
    }
    DirTreeDel(tmpde1);
}