Line | Branch | Exec | Source |
---|---|---|---|
1 | #ifndef SELECTION_H | ||
2 | #define SELECTION_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | #include <stddef.h> | ||
6 | #include "block-iter.h" | ||
7 | #include "buffer.h" | ||
8 | #include "util/macros.h" | ||
9 | #include "util/string-view.h" | ||
10 | #include "view.h" | ||
11 | |||
12 | typedef struct { | ||
13 | BlockIter si; | ||
14 | size_t so; | ||
15 | size_t eo; | ||
16 | bool swapped; | ||
17 | } SelectionInfo; | ||
18 | |||
19 | 72 | static inline void unselect(View *view) | |
20 | { | ||
21 | 72 | view->select_mode = SELECT_NONE; | |
22 |
2/2✓ Branch 0 (2→3) taken 13 times.
✓ Branch 1 (2→4) taken 59 times.
|
72 | if (view->selection) { |
23 | 13 | view->selection = SELECT_NONE; | |
24 | 13 | mark_all_lines_changed(view->buffer); | |
25 | } | ||
26 | 72 | } | |
27 | |||
28 | SelectionInfo init_selection(const View *view) NONNULL_ARGS WARN_UNUSED_RESULT; | ||
29 | size_t prepare_selection(View *view) NONNULL_ARGS WARN_UNUSED_RESULT; | ||
30 | size_t get_nr_selected_lines(const SelectionInfo *info) NONNULL_ARGS WARN_UNUSED_RESULT; | ||
31 | size_t get_nr_selected_chars(const SelectionInfo *info) NONNULL_ARGS WARN_UNUSED_RESULT; | ||
32 | |||
33 | void select_block(View *view) NONNULL_ARGS; | ||
34 | bool line_has_opening_brace(StringView line) WARN_UNUSED_RESULT; | ||
35 | bool line_has_closing_brace(StringView line) WARN_UNUSED_RESULT; | ||
36 | |||
37 | #endif | ||
38 |