dte test coverage


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 50.0% high: ≥ 85.0%
Coverage Exec / Excl / Total
Lines: 100.0% 4 / 0 / 4
Functions: 100.0% 1 / 0 / 1
Branches: -% 0 / 0 / 0

src/bookmark.h
Line Branch Exec Source
1 #ifndef BOOKMARK_H
2 #define BOOKMARK_H
3
4 #include <stdbool.h>
5 #include <stddef.h>
6 #include "command/error.h"
7 #include "util/macros.h"
8 #include "util/ptr-array.h"
9 #include "util/xmalloc.h"
10 #include "view.h"
11 #include "window.h"
12
13 typedef struct {
14 char *filename; // Needed after buffer is closed
15 unsigned long buffer_id; // Needed if buffer doesn't have a filename
16 char *pattern; // Regex from tag file (if set, line and column are 0)
17 unsigned long line, column; // File position (if non-zero, pattern is NULL)
18 } FileLocation;
19
20 303 static inline FileLocation *new_file_location (
21 char *filename, // NOLINT(readability-non-const-parameter): false positive
22 unsigned long buffer_id,
23 unsigned long line,
24 unsigned long column
25 ) {
26 303 FileLocation *loc = xmalloc(sizeof(*loc));
27 303 *loc = (FileLocation) {
28 .filename = filename,
29 .buffer_id = buffer_id,
30 .line = line,
31 .column = column
32 };
33 303 return loc;
34 }
35
36 FileLocation *get_current_file_location(const View *view) NONNULL_ARGS_AND_RETURN;
37 bool file_location_go(Window *window, ErrorBuffer *ebuf, const FileLocation *loc) NONNULL_ARGS WARN_UNUSED_RESULT;
38 void file_location_free(FileLocation *loc) NONNULL_ARGS;
39
40 size_t bookmark_push(PointerArray *bookmarks, FileLocation *loc) NONNULL_ARGS;
41 size_t bookmark_pop(PointerArray *bookmarks, Window *window, const PointerArray *buffers) NONNULL_ARGS;
42
43 #endif
44