aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mark_extended.h
blob: f809148d9b9df7904af59492716f04a6040e4348 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef NVIM_MARK_EXTENDED_H
#define NVIM_MARK_EXTENDED_H

#include "nvim/buffer_defs.h"
#include "nvim/mark_extended_defs.h"
#include "nvim/marktree.h"

EXTERN int extmark_splice_pending INIT(= 0);

typedef struct
{
  uint64_t ns_id;
  uint64_t mark_id;
  int row;
  colnr_T col;
} ExtmarkInfo;

typedef kvec_t(ExtmarkInfo) ExtmarkArray;


// delete the columns between mincol and endcol
typedef struct {
  int start_row;
  colnr_T start_col;
  int oldextent_row;
  colnr_T oldextent_col;
  int newextent_row;
  colnr_T newextent_col;
} ExtmarkSplice;

// adjust marks after :move operation
typedef struct {
  int start_row;
  int start_col;
  int extent_row;
  int extent_col;
  int new_row;
  int new_col;
} ExtmarkMove;

// extmark was updated
typedef struct {
  uint64_t mark;  // raw mark id of the marktree
  int old_row;
  colnr_T old_col;
  int row;
  colnr_T col;
} ExtmarkSavePos;

typedef enum {
  kExtmarkSplice,
  kExtmarkMove,
  kExtmarkUpdate,
  kExtmarkSavePos,
  kExtmarkClear,
} UndoObjectType;

// TODO(bfredl): reduce the number of undo action types
struct undo_object {
  UndoObjectType type;
  union {
    ExtmarkSplice splice;
    ExtmarkMove move;
    ExtmarkSavePos savepos;
  } data;
};


typedef struct {
  int start_row;
  int start_col;
  int end_row;
  int end_col;
  int attr_id;
  VirtText *virt_text;
} HlRange;

typedef struct {
  MarkTreeIter itr[1];
  kvec_t(HlRange) active;
  int top_row;
  int row;
  int col_until;
  int current;
  VirtText *virt_text;
} DecorationState;


#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "mark_extended.h.generated.h"
#endif

#endif  // NVIM_MARK_EXTENDED_H