summaryrefslogtreecommitdiff
path: root/examples/dte/bookmark.h
blob: 549658939da40c44aa24204931a4678b798ef788 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef BOOKMARK_H
#define BOOKMARK_H

#include <stdbool.h>
#include "util/macros.h"
#include "util/ptr-array.h"
#include "view.h"
#include "window.h"

typedef struct {
    char *filename; // Needed after buffer is closed
    unsigned long buffer_id; // Needed if buffer doesn't have a filename
    char *pattern; // Regex from tag file (if set, line and column are 0)
    unsigned long line, column; // File position (if non-zero, pattern is NULL)
} FileLocation;

FileLocation *get_current_file_location(const View *view) NONNULL_ARGS_AND_RETURN;
bool file_location_go(Window *window, const FileLocation *loc) NONNULL_ARGS WARN_UNUSED_RESULT;
void file_location_free(FileLocation *loc) NONNULL_ARGS;

void bookmark_push(PointerArray *bookmarks, FileLocation *loc) NONNULL_ARGS;
void bookmark_pop(Window *window, PointerArray *bookmarks) NONNULL_ARGS;

#endif