neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

extmark.h (1682B)


      1 #pragma once
      2 
      3 #include <stdbool.h>
      4 #include <stdint.h>
      5 
      6 #include "klib/kvec.h"
      7 #include "nvim/extmark_defs.h"  // IWYU pragma: keep
      8 #include "nvim/macros_defs.h"
      9 #include "nvim/marktree_defs.h"
     10 #include "nvim/pos_defs.h"
     11 #include "nvim/types_defs.h"  // IWYU pragma: keep
     12 
     13 EXTERN int curbuf_splice_pending INIT( = 0);
     14 
     15 typedef kvec_t(MTPair) ExtmarkInfoArray;
     16 
     17 // delete the columns between mincol and endcol
     18 typedef struct {
     19  int start_row;
     20  colnr_T start_col;
     21  int old_row;
     22  colnr_T old_col;
     23  int new_row;
     24  colnr_T new_col;
     25  bcount_t start_byte;
     26  bcount_t old_byte;
     27  bcount_t new_byte;
     28 } ExtmarkSplice;
     29 
     30 // adjust marks after :move operation
     31 typedef struct {
     32  int start_row;
     33  int start_col;
     34  int extent_row;
     35  int extent_col;
     36  int new_row;
     37  int new_col;
     38  bcount_t start_byte;
     39  bcount_t extent_byte;
     40  bcount_t new_byte;
     41 } ExtmarkMove;
     42 
     43 // extmark was updated
     44 typedef struct {
     45  uint64_t mark;  // raw mark id of the marktree
     46  int old_row;
     47  colnr_T old_col;
     48  bool invalidated;
     49 } ExtmarkSavePos;
     50 
     51 typedef enum {
     52  kExtmarkSplice,
     53  kExtmarkMove,
     54  kExtmarkUpdate,
     55  kExtmarkSavePos,
     56  kExtmarkClear,
     57 } UndoObjectType;
     58 
     59 // TODO(bfredl): if possible unify these with marktree flags,
     60 // so it is possible to filter extmarks directly on top-level flags
     61 typedef enum {
     62  kExtmarkNone = 0x1,
     63  kExtmarkSign = 0x2,
     64  kExtmarkSignHL = 0x4,
     65  kExtmarkVirtText = 0x8,
     66  kExtmarkVirtLines = 0x10,
     67  kExtmarkHighlight = 0x20,
     68 } ExtmarkType;
     69 
     70 // TODO(bfredl): reduce the number of undo action types
     71 struct undo_object {
     72  UndoObjectType type;
     73  union {
     74    ExtmarkSplice splice;
     75    ExtmarkMove move;
     76    ExtmarkSavePos savepos;
     77  } data;
     78 };
     79 
     80 #include "extmark.h.generated.h"