Mercurial > vim
comparison src/structs.h @ 30570:86683eee58ac v9.0.0620
patch 9.0.0620: matchaddpos() can only add up to 8 matches
Commit: https://github.com/vim/vim/commit/50faf02f43d7f1a56ec2023028fca7c72dbce83e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 29 12:50:17 2022 +0100
patch 9.0.0620: matchaddpos() can only add up to 8 matches
Problem: matchaddpos() can only add up to 8 matches.
Solution: Allocate the array of positions. (closes https://github.com/vim/vim/issues/11248)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 29 Sep 2022 14:00:09 +0200 |
parents | 221cca379bd5 |
children | 72e6073a2822 |
comparison
equal
deleted
inserted
replaced
30569:c9568bf9c963 | 30570:86683eee58ac |
---|---|
3422 // matchaddpos(). TRUE/FALSE | 3422 // matchaddpos(). TRUE/FALSE |
3423 char has_cursor; // TRUE if the cursor is inside the match, used for | 3423 char has_cursor; // TRUE if the cursor is inside the match, used for |
3424 // CurSearch | 3424 // CurSearch |
3425 } match_T; | 3425 } match_T; |
3426 | 3426 |
3427 // number of positions supported by matchaddpos() | |
3428 #define MAXPOSMATCH 8 | |
3429 | |
3430 /* | 3427 /* |
3431 * Same as lpos_T, but with additional field len. | 3428 * Same as lpos_T, but with additional field len. |
3432 */ | 3429 */ |
3433 typedef struct | 3430 typedef struct |
3434 { | 3431 { |
3436 colnr_T col; // column number | 3433 colnr_T col; // column number |
3437 int len; // length: 0 - to the end of line | 3434 int len; // length: 0 - to the end of line |
3438 } llpos_T; | 3435 } llpos_T; |
3439 | 3436 |
3440 /* | 3437 /* |
3441 * posmatch_T provides an array for storing match items for matchaddpos() | 3438 * matchitem_T provides a linked list for storing match items for ":match", |
3442 * function. | 3439 * matchadd() and matchaddpos(). |
3443 */ | |
3444 typedef struct posmatch posmatch_T; | |
3445 struct posmatch | |
3446 { | |
3447 llpos_T pos[MAXPOSMATCH]; // array of positions | |
3448 int cur; // internal position counter | |
3449 linenr_T toplnum; // top buffer line | |
3450 linenr_T botlnum; // bottom buffer line | |
3451 }; | |
3452 | |
3453 /* | |
3454 * matchitem_T provides a linked list for storing match items for ":match" and | |
3455 * the match functions. | |
3456 */ | 3440 */ |
3457 typedef struct matchitem matchitem_T; | 3441 typedef struct matchitem matchitem_T; |
3458 struct matchitem | 3442 struct matchitem |
3459 { | 3443 { |
3460 matchitem_T *next; | 3444 matchitem_T *mit_next; |
3461 int id; // match ID | 3445 int mit_id; // match ID |
3462 int priority; // match priority | 3446 int mit_priority; // match priority |
3463 char_u *pattern; // pattern to highlight | 3447 |
3464 regmmatch_T match; // regexp program for pattern | 3448 // Either a pattern is defined (mit_pattern is not NUL) or a list of |
3465 posmatch_T pos; // position matches | 3449 // positions is given (mit_pos is not NULL and mit_pos_count > 0). |
3466 match_T hl; // struct for doing the actual highlighting | 3450 char_u *mit_pattern; // pattern to highlight |
3467 int hlg_id; // highlight group ID | 3451 regmmatch_T mit_match; // regexp program for pattern |
3452 | |
3453 llpos_T *mit_pos_array; // array of positions | |
3454 int mit_pos_count; // nr of entries in mit_pos | |
3455 int mit_pos_cur; // internal position counter | |
3456 linenr_T mit_toplnum; // top buffer line | |
3457 linenr_T mit_botlnum; // bottom buffer line | |
3458 | |
3459 match_T mit_hl; // struct for doing the actual highlighting | |
3460 int mit_hlg_id; // highlight group ID | |
3468 #ifdef FEAT_CONCEAL | 3461 #ifdef FEAT_CONCEAL |
3469 int conceal_char; // cchar for Conceal highlighting | 3462 int mit_conceal_char; // cchar for Conceal highlighting |
3470 #endif | 3463 #endif |
3471 }; | 3464 }; |
3472 | 3465 |
3473 // Structure to store last cursor position and topline. Used by check_lnums() | 3466 // Structure to store last cursor position and topline. Used by check_lnums() |
3474 // and reset_lnums(). | 3467 // and reset_lnums(). |