dte test coverage


Directory: ./
File: src/copy.h
Date: 2025-02-14 16:55:22
Exec Total Coverage
Lines: 7 7 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 #ifndef COPY_H
2 #define COPY_H
3
4 #include <stdbool.h>
5 #include <stddef.h>
6 #include <stdlib.h>
7 #include "util/debug.h"
8 #include "util/macros.h"
9 #include "view.h"
10
11 typedef struct {
12 char *buf;
13 size_t len;
14 bool is_lines;
15 } Clipboard;
16
17 typedef enum {
18 PASTE_LINES_BELOW_CURSOR,
19 PASTE_LINES_ABOVE_CURSOR,
20 PASTE_LINES_INLINE,
21 } PasteLinesType;
22
23 6 static inline void record_copy(Clipboard *clip, char *buf, size_t len, bool is_lines)
24 {
25 6 BUG_ON(len && !buf);
26 6 free(clip->buf);
27 6 clip->buf = buf; // Takes ownership
28 6 clip->len = len;
29 6 clip->is_lines = is_lines;
30 6 }
31
32 void paste(Clipboard *clip, View *view, PasteLinesType type, bool move_after);
33
34 #endif
35