Mercurial > vim
diff src/structs.h @ 15138:9df130fd5e0d v8.1.0579
patch 8.1.0579: cannot attach properties to text
commit https://github.com/vim/vim/commit/98aefe7c3250bb5d4153b994f878594d1745424e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 13 22:20:09 2018 +0100
patch 8.1.0579: cannot attach properties to text
Problem: Cannot attach properties to text.
Solution: First part of adding text properties.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 13 Dec 2018 22:30:08 +0100 |
parents | 67e3103d6e18 |
children | 3a99b2e6d136 |
line wrap: on
line diff
--- a/src/structs.h +++ b/src/structs.h @@ -684,6 +684,7 @@ typedef struct memline linenr_T ml_line_lnum; /* line number of cached line, 0 if not valid */ char_u *ml_line_ptr; /* pointer to cached line */ + colnr_T ml_line_len; /* length of the cached line, including NUL */ bhdr_T *ml_locked; /* block used by last ml_get */ linenr_T ml_locked_low; /* first line in ml_locked */ @@ -696,6 +697,41 @@ typedef struct memline #endif } memline_T; + +/* + * Structure defining text properties. These stick with the text. + * When stored in memline they are after the text, ml_line_len is larger than + * STRLEN(ml_line_ptr) + 1. + */ +typedef struct textprop_S +{ + colnr_T tp_col; // start column + colnr_T tp_len; // length in bytes + int tp_id; // identifier + int tp_type; // property type + int tp_flags; // TP_FLAG_ values +} textprop_T; + +#define TP_FLAG_CONT_NEXT 1 // property continues in next line +#define TP_FLAG_CONT_PREV 2 // property was continued from prev line + +/* + * Structure defining a property type. + */ +typedef struct proptype_S +{ + int pt_id; // value used for tp_id + int pt_type; // number used for tp_type + int pt_hl_id; // highlighting + int pt_priority; // priority + int pt_flags; // PT_FLAG_ values + char_u pt_name[1]; // property type name, actually longer +} proptype_T; + +#define PT_FLAG_INS_START_INCL 1 // insert at start included in property +#define PT_FLAG_INS_END_INCL 2 // insert at end included in property + + #if defined(FEAT_SIGNS) || defined(PROTO) typedef struct signlist signlist_T; @@ -2358,6 +2394,9 @@ struct file_buffer dictitem_T b_bufvar; /* variable for "b:" Dictionary */ dict_T *b_vars; /* internal variables, local to buffer */ #endif +#ifdef FEAT_TEXT_PROP + hashtab_T *b_proptypes; /* text property types local to buffer */ +#endif #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) char_u *b_p_bexpr; /* 'balloonexpr' local value */