To: vim_dev@googlegroups.com Subject: Patch 8.1.2205 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2205 Problem: Sign entry structure has confusing name. Solution: Rename signlist_T to sign_entry_T and prefix se_ to the fields. Files: src/structs.h, src/netbeans.c, src/sign.c, src/globals.h, src/drawline.c *** ../vim-8.1.2204/src/structs.h 2019-10-18 20:53:30.693741624 +0200 --- src/structs.h 2019-10-24 14:40:14.977105272 +0200 *************** *** 771,803 **** // Sign group typedef struct signgroup_S { ! int next_sign_id; // next sign id for this group ! short_u refcount; // number of signs in this group char_u sg_name[1]; // sign group name, actually longer } signgroup_T; ! typedef struct signlist signlist_T; ! ! struct signlist { ! int id; // unique identifier for each placed sign ! linenr_T lnum; // line number which has this sign ! int typenr; // typenr of sign ! signgroup_T *group; // sign group ! int priority; // priority for highlighting ! signlist_T *next; // next signlist entry ! signlist_T *prev; // previous entry -- for easy reordering }; /* * Sign attributes. Used by the screen refresh routines. */ typedef struct sign_attrs_S { ! int typenr; ! void *icon; ! char_u *text; ! int texthl; ! int linehl; } sign_attrs_T; #if defined(FEAT_SIGNS) || defined(PROTO) --- 771,802 ---- // Sign group typedef struct signgroup_S { ! int sg_next_sign_id; // next sign id for this group ! short_u sg_refcount; // number of signs in this group char_u sg_name[1]; // sign group name, actually longer } signgroup_T; ! typedef struct sign_entry sign_entry_T; ! struct sign_entry { ! int se_id; // unique identifier for each placed sign ! linenr_T se_lnum; // line number which has this sign ! int se_typenr; // typenr of sign ! signgroup_T *se_group; // sign group ! int se_priority; // priority for highlighting ! sign_entry_T *se_next; // next entry in a list of signs ! sign_entry_T *se_prev; // previous entry -- for easy reordering }; /* * Sign attributes. Used by the screen refresh routines. */ typedef struct sign_attrs_S { ! int sat_typenr; ! void *sat_icon; ! char_u *sat_text; ! int sat_texthl; ! int sat_linehl; } sign_attrs_T; #if defined(FEAT_SIGNS) || defined(PROTO) *************** *** 2675,2681 **** #endif #ifdef FEAT_SIGNS ! signlist_T *b_signlist; // list of signs to draw # ifdef FEAT_NETBEANS_INTG int b_has_sign_column; // Flag that is set when a first sign is // added and remains set until the end of --- 2674,2680 ---- #endif #ifdef FEAT_SIGNS ! sign_entry_T *b_signlist; // list of placed signs # ifdef FEAT_NETBEANS_INTG int b_has_sign_column; // Flag that is set when a first sign is // added and remains set until the end of *** ../vim-8.1.2204/src/netbeans.c 2019-08-19 20:08:12.044411941 +0200 --- src/netbeans.c 2019-10-24 14:38:16.137527467 +0200 *************** *** 2977,2992 **** int netbeans_is_guarded(linenr_T top, linenr_T bot) { ! signlist_T *p; ! int lnum; if (!NETBEANS_OPEN) return FALSE; ! for (p = curbuf->b_signlist; p != NULL; p = p->next) ! if (p->id >= GUARDEDOFFSET) for (lnum = top + 1; lnum < bot; lnum++) ! if (lnum == p->lnum) return TRUE; return FALSE; --- 2977,2992 ---- int netbeans_is_guarded(linenr_T top, linenr_T bot) { ! sign_entry_T *p; ! int lnum; if (!NETBEANS_OPEN) return FALSE; ! for (p = curbuf->b_signlist; p != NULL; p = p->se_next) ! if (p->se_id >= GUARDEDOFFSET) for (lnum = top + 1; lnum < bot; lnum++) ! if (lnum == p->se_lnum) return TRUE; return FALSE; *************** *** 3091,3126 **** void netbeans_gutter_click(linenr_T lnum) { ! signlist_T *p; if (!NETBEANS_OPEN) return; ! for (p = curbuf->b_signlist; p != NULL; p = p->next) { ! if (p->lnum == lnum && p->next && p->next->lnum == lnum) { ! signlist_T *tail; /* remove "p" from list, reinsert it at the tail of the sublist */ ! if (p->prev) ! p->prev->next = p->next; else ! curbuf->b_signlist = p->next; ! p->next->prev = p->prev; /* now find end of sublist and insert p */ ! for (tail = p->next; ! tail->next && tail->next->lnum == lnum ! && tail->next->id < GUARDEDOFFSET; ! tail = tail->next) ; /* tail now points to last entry with same lnum (except * that "guarded" annotations are always last) */ ! p->next = tail->next; ! if (tail->next) ! tail->next->prev = p; ! p->prev = tail; ! tail->next = p; update_debug_sign(curbuf, lnum); break; } --- 3091,3126 ---- void netbeans_gutter_click(linenr_T lnum) { ! sign_entry_T *p; if (!NETBEANS_OPEN) return; ! for (p = curbuf->b_signlist; p != NULL; p = p->se_next) { ! if (p->se_lnum == lnum && p->se_next && p->se_next->se_lnum == lnum) { ! sign_entry_T *tail; /* remove "p" from list, reinsert it at the tail of the sublist */ ! if (p->se_prev) ! p->se_prev->se_next = p->se_next; else ! curbuf->b_signlist = p->se_next; ! p->se_next->se_prev = p->se_prev; /* now find end of sublist and insert p */ ! for (tail = p->se_next; ! tail->se_next && tail->se_next->se_lnum == lnum ! && tail->se_next->se_id < GUARDEDOFFSET; ! tail = tail->se_next) ; /* tail now points to last entry with same lnum (except * that "guarded" annotations are always last) */ ! p->se_next = tail->se_next; ! if (tail->se_next) ! tail->se_next->se_prev = p; ! p->se_prev = tail; ! tail->se_next = p; update_debug_sign(curbuf, lnum); break; } *** ../vim-8.1.2204/src/sign.c 2019-08-21 13:20:26.270838217 +0200 --- src/sign.c 2019-10-24 14:54:07.228655154 +0200 *************** *** 89,103 **** if (group == NULL) return NULL; STRCPY(group->sg_name, groupname); ! group->refcount = 1; ! group->next_sign_id = 1; hash_add_item(&sg_table, hi, group->sg_name, hash); } else { // existing group group = HI2SG(hi); ! group->refcount++; } return group; --- 89,103 ---- if (group == NULL) return NULL; STRCPY(group->sg_name, groupname); ! group->sg_refcount = 1; ! group->sg_next_sign_id = 1; hash_add_item(&sg_table, hi, group->sg_name, hash); } else { // existing group group = HI2SG(hi); ! group->sg_refcount++; } return group; *************** *** 117,124 **** if (!HASHITEM_EMPTY(hi)) { group = HI2SG(hi); ! group->refcount--; ! if (group->refcount == 0) { // All the signs in this group are removed hash_remove(&sg_table, hi); --- 117,124 ---- if (!HASHITEM_EMPTY(hi)) { group = HI2SG(hi); ! group->sg_refcount--; ! if (group->sg_refcount == 0) { // All the signs in this group are removed hash_remove(&sg_table, hi); *************** *** 129,144 **** /* * Returns TRUE if 'sign' is in 'group'. ! * A sign can either be in the global group (sign->group == NULL) * or in a named group. If 'group' is '*', then the sign is part of the group. */ static int ! sign_in_group(signlist_T *sign, char_u *group) { return ((group != NULL && STRCMP(group, "*") == 0) ! || (group == NULL && sign->group == NULL) ! || (group != NULL && sign->group != NULL ! && STRCMP(group, sign->group->sg_name) == 0)); } /* --- 129,144 ---- /* * Returns TRUE if 'sign' is in 'group'. ! * A sign can either be in the global group (sign->se_group == NULL) * or in a named group. If 'group' is '*', then the sign is part of the group. */ static int ! sign_in_group(sign_entry_T *sign, char_u *group) { return ((group != NULL && STRCMP(group, "*") == 0) ! || (group == NULL && sign->se_group == NULL) ! || (group != NULL && sign->se_group != NULL ! && STRCMP(group, sign->se_group->sg_name) == 0)); } /* *************** *** 149,155 **** { int id = 1; signgroup_T *group = NULL; ! signlist_T *sign; hashitem_T *hi; int found = FALSE; --- 149,155 ---- { int id = 1; signgroup_T *group = NULL; ! sign_entry_T *sign; hashitem_T *hi; int found = FALSE; *************** *** 167,179 **** if (group == NULL) id = next_sign_id++; // global group else ! id = group->next_sign_id++; // Check whether this sign is already placed in the buffer found = TRUE; FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (id == sign->id && sign_in_group(sign, groupname)) { found = FALSE; // sign identifier is in use break; --- 167,179 ---- if (group == NULL) id = next_sign_id++; // global group else ! id = group->sg_next_sign_id++; // Check whether this sign is already placed in the buffer found = TRUE; FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (id == sign->se_id && sign_in_group(sign, groupname)) { found = FALSE; // sign identifier is in use break; *************** *** 191,228 **** static void insert_sign( buf_T *buf, // buffer to store sign in ! signlist_T *prev, // previous sign entry ! signlist_T *next, // next sign entry int id, // sign ID char_u *group, // sign group; NULL for global group int prio, // sign priority linenr_T lnum, // line number which gets the mark int typenr) // typenr of sign we are adding { ! signlist_T *newsign; ! newsign = lalloc_id(sizeof(signlist_T), FALSE, aid_insert_sign); if (newsign != NULL) { ! newsign->id = id; ! newsign->lnum = lnum; ! newsign->typenr = typenr; if (group != NULL) { ! newsign->group = sign_group_ref(group); ! if (newsign->group == NULL) { vim_free(newsign); return; } } else ! newsign->group = NULL; ! newsign->priority = prio; ! newsign->next = next; ! newsign->prev = prev; if (next != NULL) ! next->prev = newsign; if (prev == NULL) { --- 191,228 ---- static void insert_sign( buf_T *buf, // buffer to store sign in ! sign_entry_T *prev, // previous sign entry ! sign_entry_T *next, // next sign entry int id, // sign ID char_u *group, // sign group; NULL for global group int prio, // sign priority linenr_T lnum, // line number which gets the mark int typenr) // typenr of sign we are adding { ! sign_entry_T *newsign; ! newsign = lalloc_id(sizeof(sign_entry_T), FALSE, aid_insert_sign); if (newsign != NULL) { ! newsign->se_id = id; ! newsign->se_lnum = lnum; ! newsign->se_typenr = typenr; if (group != NULL) { ! newsign->se_group = sign_group_ref(group); ! if (newsign->se_group == NULL) { vim_free(newsign); return; } } else ! newsign->se_group = NULL; ! newsign->se_priority = prio; ! newsign->se_next = next; ! newsign->se_prev = prev; if (next != NULL) ! next->se_prev = newsign; if (prev == NULL) { *************** *** 242,248 **** #endif } else ! prev->next = newsign; } } --- 242,248 ---- #endif } else ! prev->se_next = newsign; } } *************** *** 252,274 **** static void insert_sign_by_lnum_prio( buf_T *buf, // buffer to store sign in ! signlist_T *prev, // previous sign entry int id, // sign ID char_u *group, // sign group; NULL for global group int prio, // sign priority linenr_T lnum, // line number which gets the mark int typenr) // typenr of sign we are adding { ! signlist_T *sign; // keep signs sorted by lnum and by priority: insert new sign at // the proper position in the list for this lnum. ! while (prev != NULL && prev->lnum == lnum && prev->priority <= prio) ! prev = prev->prev; if (prev == NULL) sign = buf->b_signlist; else ! sign = prev->next; insert_sign(buf, prev, sign, id, group, prio, lnum, typenr); } --- 252,274 ---- static void insert_sign_by_lnum_prio( buf_T *buf, // buffer to store sign in ! sign_entry_T *prev, // previous sign entry int id, // sign ID char_u *group, // sign group; NULL for global group int prio, // sign priority linenr_T lnum, // line number which gets the mark int typenr) // typenr of sign we are adding { ! sign_entry_T *sign; // keep signs sorted by lnum and by priority: insert new sign at // the proper position in the list for this lnum. ! while (prev != NULL && prev->se_lnum == lnum && prev->se_priority <= prio) ! prev = prev->se_prev; if (prev == NULL) sign = buf->b_signlist; else ! sign = prev->se_next; insert_sign(buf, prev, sign, id, group, prio, lnum, typenr); } *************** *** 305,322 **** * Return information about a sign in a Dict */ static dict_T * ! sign_get_info(signlist_T *sign) { dict_T *d; if ((d = dict_alloc_id(aid_sign_getinfo)) == NULL) return NULL; ! dict_add_number(d, "id", sign->id); ! dict_add_string(d, "group", (sign->group == NULL) ? ! (char_u *)"" : sign->group->sg_name); ! dict_add_number(d, "lnum", sign->lnum); ! dict_add_string(d, "name", sign_typenr2name(sign->typenr)); ! dict_add_number(d, "priority", sign->priority); return d; } --- 305,322 ---- * Return information about a sign in a Dict */ static dict_T * ! sign_get_info(sign_entry_T *sign) { dict_T *d; if ((d = dict_alloc_id(aid_sign_getinfo)) == NULL) return NULL; ! dict_add_number(d, "id", sign->se_id); ! dict_add_string(d, "group", (sign->se_group == NULL) ? ! (char_u *)"" : sign->se_group->sg_name); ! dict_add_number(d, "lnum", sign->se_lnum); ! dict_add_string(d, "name", sign_typenr2name(sign->se_typenr)); ! dict_add_number(d, "priority", sign->se_priority); return d; } *************** *** 327,344 **** * buffer are sorted by line number and priority. */ static void ! sign_sort_by_prio_on_line(buf_T *buf, signlist_T *sign) { ! signlist_T *p = NULL; // If there is only one sign in the buffer or only one sign on the line or // the sign is already sorted by priority, then return. ! if ((sign->prev == NULL ! || sign->prev->lnum != sign->lnum ! || sign->prev->priority > sign->priority) ! && (sign->next == NULL ! || sign->next->lnum != sign->lnum ! || sign->next->priority < sign->priority)) return; // One or more signs on the same line as 'sign' --- 327,344 ---- * buffer are sorted by line number and priority. */ static void ! sign_sort_by_prio_on_line(buf_T *buf, sign_entry_T *sign) { ! sign_entry_T *p = NULL; // If there is only one sign in the buffer or only one sign on the line or // the sign is already sorted by priority, then return. ! if ((sign->se_prev == NULL ! || sign->se_prev->se_lnum != sign->se_lnum ! || sign->se_prev->se_priority > sign->se_priority) ! && (sign->se_next == NULL ! || sign->se_next->se_lnum != sign->se_lnum ! || sign->se_next->se_priority < sign->se_priority)) return; // One or more signs on the same line as 'sign' *************** *** 346,395 **** // First search backward for a sign with higher priority on the same line p = sign; ! while (p->prev != NULL && p->prev->lnum == sign->lnum ! && p->prev->priority <= sign->priority) ! p = p->prev; if (p == sign) { // Sign not found. Search forward for a sign with priority just before // 'sign'. ! p = sign->next; ! while (p->next != NULL && p->next->lnum == sign->lnum ! && p->next->priority > sign->priority) ! p = p->next; } // Remove 'sign' from the list if (buf->b_signlist == sign) ! buf->b_signlist = sign->next; ! if (sign->prev != NULL) ! sign->prev->next = sign->next; ! if (sign->next != NULL) ! sign->next->prev = sign->prev; ! sign->prev = NULL; ! sign->next = NULL; // Re-insert 'sign' at the right place ! if (p->priority <= sign->priority) { // 'sign' has a higher priority and should be inserted before 'p' ! sign->prev = p->prev; ! sign->next = p; ! p->prev = sign; ! if (sign->prev != NULL) ! sign->prev->next = sign; if (buf->b_signlist == p) buf->b_signlist = sign; } else { // 'sign' has a lower priority and should be inserted after 'p' ! sign->prev = p; ! sign->next = p->next; ! p->next = sign; ! if (sign->next != NULL) ! sign->next->prev = sign; } } --- 346,395 ---- // First search backward for a sign with higher priority on the same line p = sign; ! while (p->se_prev != NULL && p->se_prev->se_lnum == sign->se_lnum ! && p->se_prev->se_priority <= sign->se_priority) ! p = p->se_prev; if (p == sign) { // Sign not found. Search forward for a sign with priority just before // 'sign'. ! p = sign->se_next; ! while (p->se_next != NULL && p->se_next->se_lnum == sign->se_lnum ! && p->se_next->se_priority > sign->se_priority) ! p = p->se_next; } // Remove 'sign' from the list if (buf->b_signlist == sign) ! buf->b_signlist = sign->se_next; ! if (sign->se_prev != NULL) ! sign->se_prev->se_next = sign->se_next; ! if (sign->se_next != NULL) ! sign->se_next->se_prev = sign->se_prev; ! sign->se_prev = NULL; ! sign->se_next = NULL; // Re-insert 'sign' at the right place ! if (p->se_priority <= sign->se_priority) { // 'sign' has a higher priority and should be inserted before 'p' ! sign->se_prev = p->se_prev; ! sign->se_next = p; ! p->se_prev = sign; ! if (sign->se_prev != NULL) ! sign->se_prev->se_next = sign; if (buf->b_signlist == p) buf->b_signlist = sign; } else { // 'sign' has a lower priority and should be inserted after 'p' ! sign->se_prev = p; ! sign->se_next = p->se_next; ! p->se_next = sign; ! if (sign->se_next != NULL) ! sign->se_next->se_prev = sign; } } *************** *** 405,426 **** linenr_T lnum, // line number which gets the mark int typenr) // typenr of sign we are adding { ! signlist_T *sign; // a sign in the signlist ! signlist_T *prev; // the previous sign prev = NULL; FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (lnum == sign->lnum && id == sign->id && sign_in_group(sign, groupname)) { // Update an existing sign ! sign->typenr = typenr; ! sign->priority = prio; sign_sort_by_prio_on_line(buf, sign); return; } ! else if (lnum < sign->lnum) { insert_sign_by_lnum_prio(buf, prev, id, groupname, prio, lnum, typenr); --- 405,426 ---- linenr_T lnum, // line number which gets the mark int typenr) // typenr of sign we are adding { ! sign_entry_T *sign; // a sign in the signlist ! sign_entry_T *prev; // the previous sign prev = NULL; FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (lnum == sign->se_lnum && id == sign->se_id && sign_in_group(sign, groupname)) { // Update an existing sign ! sign->se_typenr = typenr; ! sign->se_priority = prio; sign_sort_by_prio_on_line(buf, sign); return; } ! else if (lnum < sign->se_lnum) { insert_sign_by_lnum_prio(buf, prev, id, groupname, prio, lnum, typenr); *************** *** 445,460 **** int typenr, // typenr of sign we are adding int prio) // sign priority { ! signlist_T *sign; // a sign in the signlist FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (sign->id == markId && sign_in_group(sign, group)) { ! sign->typenr = typenr; ! sign->priority = prio; sign_sort_by_prio_on_line(buf, sign); ! return sign->lnum; } } --- 445,460 ---- int typenr, // typenr of sign we are adding int prio) // sign priority { ! sign_entry_T *sign; // a sign in the signlist FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (sign->se_id == markId && sign_in_group(sign, group)) { ! sign->se_typenr = typenr; ! sign->se_priority = prio; sign_sort_by_prio_on_line(buf, sign); ! return sign->se_lnum; } } *************** *** 469,501 **** int buf_get_signattrs(buf_T *buf, linenr_T lnum, sign_attrs_T *sattr) { ! signlist_T *sign; ! sign_T *sp; vim_memset(sattr, 0, sizeof(sign_attrs_T)); FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (sign->lnum > lnum) // Signs are sorted by line number in the buffer. No need to check // for signs after the specified line number 'lnum'. break; ! if (sign->lnum == lnum) { ! sattr->typenr = sign->typenr; ! sp = find_sign_by_typenr(sign->typenr); if (sp == NULL) return FALSE; # ifdef FEAT_SIGN_ICONS ! sattr->icon = sp->sn_image; # endif ! sattr->text = sp->sn_text; ! if (sattr->text != NULL && sp->sn_text_hl > 0) ! sattr->texthl = syn_id2attr(sp->sn_text_hl); if (sp->sn_line_hl > 0) ! sattr->linehl = syn_id2attr(sp->sn_line_hl); return TRUE; } } --- 469,501 ---- int buf_get_signattrs(buf_T *buf, linenr_T lnum, sign_attrs_T *sattr) { ! sign_entry_T *sign; ! sign_T *sp; vim_memset(sattr, 0, sizeof(sign_attrs_T)); FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (sign->se_lnum > lnum) // Signs are sorted by line number in the buffer. No need to check // for signs after the specified line number 'lnum'. break; ! if (sign->se_lnum == lnum) { ! sattr->sat_typenr = sign->se_typenr; ! sp = find_sign_by_typenr(sign->se_typenr); if (sp == NULL) return FALSE; # ifdef FEAT_SIGN_ICONS ! sattr->sat_icon = sp->sn_image; # endif ! sattr->sat_text = sp->sn_text; ! if (sattr->sat_text != NULL && sp->sn_text_hl > 0) ! sattr->sat_texthl = syn_id2attr(sp->sn_text_hl); if (sp->sn_line_hl > 0) ! sattr->sat_linehl = syn_id2attr(sp->sn_line_hl); return TRUE; } } *************** *** 519,545 **** int id, // sign id char_u *group) // sign group { ! signlist_T **lastp; // pointer to pointer to current sign ! signlist_T *sign; // a sign in a b_signlist ! signlist_T *next; // the next sign in a b_signlist ! linenr_T lnum; // line number whose sign was deleted lastp = &buf->b_signlist; lnum = 0; for (sign = buf->b_signlist; sign != NULL; sign = next) { ! next = sign->next; ! if ((id == 0 || sign->id == id) ! && (atlnum == 0 || sign->lnum == atlnum) && sign_in_group(sign, group)) { *lastp = next; if (next != NULL) ! next->prev = sign->prev; ! lnum = sign->lnum; ! if (sign->group != NULL) ! sign_group_unref(sign->group->sg_name); vim_free(sign); redraw_buf_line_later(buf, lnum); --- 519,545 ---- int id, // sign id char_u *group) // sign group { ! sign_entry_T **lastp; // pointer to pointer to current sign ! sign_entry_T *sign; // a sign in a b_signlist ! sign_entry_T *next; // the next sign in a b_signlist ! linenr_T lnum; // line number whose sign was deleted lastp = &buf->b_signlist; lnum = 0; for (sign = buf->b_signlist; sign != NULL; sign = next) { ! next = sign->se_next; ! if ((id == 0 || sign->se_id == id) ! && (atlnum == 0 || sign->se_lnum == atlnum) && sign_in_group(sign, group)) { *lastp = next; if (next != NULL) ! next->se_prev = sign->se_prev; ! lnum = sign->se_lnum; ! if (sign->se_group != NULL) ! sign_group_unref(sign->se_group->sg_name); vim_free(sign); redraw_buf_line_later(buf, lnum); *************** *** 553,559 **** break; } else ! lastp = &sign->next; } // When deleting the last sign the cursor position may change, because the --- 553,559 ---- break; } else ! lastp = &sign->se_next; } // When deleting the last sign the cursor position may change, because the *************** *** 579,589 **** int id, // sign ID char_u *group) // sign group { ! signlist_T *sign; // a sign in the signlist FOR_ALL_SIGNS_IN_BUF(buf, sign) ! if (sign->id == id && sign_in_group(sign, group)) ! return sign->lnum; return 0; } --- 579,589 ---- int id, // sign ID char_u *group) // sign group { ! sign_entry_T *sign; // a sign in the signlist FOR_ALL_SIGNS_IN_BUF(buf, sign) ! if (sign->se_id == id && sign_in_group(sign, group)) ! return sign->se_lnum; return 0; } *************** *** 592,613 **** * Return the sign at line 'lnum' in buffer 'buf'. Returns NULL if a sign is * not found at the line. If 'groupname' is NULL, searches in the global group. */ ! static signlist_T * buf_getsign_at_line( buf_T *buf, // buffer whose sign we are searching for linenr_T lnum, // line number of sign char_u *groupname) // sign group name { ! signlist_T *sign; // a sign in the signlist FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (sign->lnum > lnum) // Signs are sorted by line number in the buffer. No need to check // for signs after the specified line number 'lnum'. break; ! if (sign->lnum == lnum && sign_in_group(sign, groupname)) return sign; } --- 592,613 ---- * Return the sign at line 'lnum' in buffer 'buf'. Returns NULL if a sign is * not found at the line. If 'groupname' is NULL, searches in the global group. */ ! static sign_entry_T * buf_getsign_at_line( buf_T *buf, // buffer whose sign we are searching for linenr_T lnum, // line number of sign char_u *groupname) // sign group name { ! sign_entry_T *sign; // a sign in the signlist FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (sign->se_lnum > lnum) // Signs are sorted by line number in the buffer. No need to check // for signs after the specified line number 'lnum'. break; ! if (sign->se_lnum == lnum && sign_in_group(sign, groupname)) return sign; } *************** *** 623,633 **** linenr_T lnum, // line number of sign char_u *groupname) // sign group name { ! signlist_T *sign; // a sign in the signlist sign = buf_getsign_at_line(buf, lnum, groupname); if (sign != NULL) ! return sign->id; return 0; } --- 623,633 ---- linenr_T lnum, // line number of sign char_u *groupname) // sign group name { ! sign_entry_T *sign; // a sign in the signlist sign = buf_getsign_at_line(buf, lnum, groupname); if (sign != NULL) ! return sign->se_id; return 0; } *************** *** 642,658 **** linenr_T lnum, // line number of sign int typenr) // sign type number { ! signlist_T *sign; // a sign in the signlist FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (sign->lnum > lnum) // Signs are sorted by line number in the buffer. No need to check // for signs after the specified line number 'lnum'. break; ! if (sign->lnum == lnum && sign->typenr == typenr) ! return sign->id; } return 0; --- 642,658 ---- linenr_T lnum, // line number of sign int typenr) // sign type number { ! sign_entry_T *sign; // a sign in the signlist FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (sign->se_lnum > lnum) // Signs are sorted by line number in the buffer. No need to check // for signs after the specified line number 'lnum'. break; ! if (sign->se_lnum == lnum && sign->se_typenr == typenr) ! return sign->se_id; } return 0; *************** *** 666,683 **** int buf_signcount(buf_T *buf, linenr_T lnum) { ! signlist_T *sign; // a sign in the signlist ! int count = 0; FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (sign->lnum > lnum) // Signs are sorted by line number in the buffer. No need to check // for signs after the specified line number 'lnum'. break; ! if (sign->lnum == lnum) ! if (sign_get_image(sign->typenr) != NULL) count++; } --- 666,683 ---- int buf_signcount(buf_T *buf, linenr_T lnum) { ! sign_entry_T *sign; // a sign in the signlist ! int count = 0; FOR_ALL_SIGNS_IN_BUF(buf, sign) { ! if (sign->se_lnum > lnum) // Signs are sorted by line number in the buffer. No need to check // for signs after the specified line number 'lnum'. break; ! if (sign->se_lnum == lnum) ! if (sign_get_image(sign->se_typenr) != NULL) count++; } *************** *** 693,701 **** void buf_delete_signs(buf_T *buf, char_u *group) { ! signlist_T *sign; ! signlist_T **lastp; // pointer to pointer to current sign ! signlist_T *next; // When deleting the last sign need to redraw the windows to remove the // sign column. Not when curwin is NULL (this means we're exiting). --- 693,701 ---- void buf_delete_signs(buf_T *buf, char_u *group) { ! sign_entry_T *sign; ! sign_entry_T **lastp; // pointer to pointer to current sign ! sign_entry_T *next; // When deleting the last sign need to redraw the windows to remove the // sign column. Not when curwin is NULL (this means we're exiting). *************** *** 708,725 **** lastp = &buf->b_signlist; for (sign = buf->b_signlist; sign != NULL; sign = next) { ! next = sign->next; if (sign_in_group(sign, group)) { *lastp = next; if (next != NULL) ! next->prev = sign->prev; ! if (sign->group != NULL) ! sign_group_unref(sign->group->sg_name); vim_free(sign); } else ! lastp = &sign->next; } } --- 708,725 ---- lastp = &buf->b_signlist; for (sign = buf->b_signlist; sign != NULL; sign = next) { ! next = sign->se_next; if (sign_in_group(sign, group)) { *lastp = next; if (next != NULL) ! next->se_prev = sign->se_prev; ! if (sign->se_group != NULL) ! sign_group_unref(sign->se_group->sg_name); vim_free(sign); } else ! lastp = &sign->se_next; } } *************** *** 729,738 **** static void sign_list_placed(buf_T *rbuf, char_u *sign_group) { ! buf_T *buf; ! signlist_T *sign; ! char lbuf[MSG_BUF_LEN]; ! char group[MSG_BUF_LEN]; msg_puts_title(_("\n--- Signs ---")); msg_putchar('\n'); --- 729,738 ---- static void sign_list_placed(buf_T *rbuf, char_u *sign_group) { ! buf_T *buf; ! sign_entry_T *sign; ! char lbuf[MSG_BUF_LEN]; ! char group[MSG_BUF_LEN]; msg_puts_title(_("\n--- Signs ---")); msg_putchar('\n'); *************** *** 754,768 **** break; if (!sign_in_group(sign, sign_group)) continue; ! if (sign->group != NULL) vim_snprintf(group, MSG_BUF_LEN, _(" group=%s"), ! sign->group->sg_name); else group[0] = '\0'; vim_snprintf(lbuf, MSG_BUF_LEN, _(" line=%ld id=%d%s name=%s priority=%d"), ! (long)sign->lnum, sign->id, group, ! sign_typenr2name(sign->typenr), sign->priority); msg_puts(lbuf); msg_putchar('\n'); } --- 754,768 ---- break; if (!sign_in_group(sign, sign_group)) continue; ! if (sign->se_group != NULL) vim_snprintf(group, MSG_BUF_LEN, _(" group=%s"), ! sign->se_group->sg_name); else group[0] = '\0'; vim_snprintf(lbuf, MSG_BUF_LEN, _(" line=%ld id=%d%s name=%s priority=%d"), ! (long)sign->se_lnum, sign->se_id, group, ! sign_typenr2name(sign->se_typenr), sign->se_priority); msg_puts(lbuf); msg_putchar('\n'); } *************** *** 782,802 **** long amount, long amount_after) { ! signlist_T *sign; // a sign in a b_signlist ! linenr_T new_lnum; FOR_ALL_SIGNS_IN_BUF(curbuf, sign) { // Ignore changes to lines after the sign ! if (sign->lnum < line1) continue; ! new_lnum = sign->lnum; ! if (sign->lnum >= line1 && sign->lnum <= line2) { if (amount != MAXLNUM) new_lnum += amount; } ! else if (sign->lnum > line2) // Lines inserted or deleted before the sign new_lnum += amount_after; --- 782,802 ---- long amount, long amount_after) { ! sign_entry_T *sign; // a sign in a b_signlist ! linenr_T new_lnum; FOR_ALL_SIGNS_IN_BUF(curbuf, sign) { // Ignore changes to lines after the sign ! if (sign->se_lnum < line1) continue; ! new_lnum = sign->se_lnum; ! if (sign->se_lnum >= line1 && sign->se_lnum <= line2) { if (amount != MAXLNUM) new_lnum += amount; } ! else if (sign->se_lnum > line2) // Lines inserted or deleted before the sign new_lnum += amount_after; *************** *** 804,810 **** // then don't adjust the line number. Otherwise, it will always be past // the last line and will not be visible. if (new_lnum <= curbuf->b_ml.ml_line_count) ! sign->lnum = new_lnum; } } --- 804,810 ---- // then don't adjust the line number. Otherwise, it will always be past // the last line and will not be visible. if (new_lnum <= curbuf->b_ml.ml_line_count) ! sign->se_lnum = new_lnum; } } *************** *** 1694,1701 **** void get_buffer_signs(buf_T *buf, list_T *l) { ! signlist_T *sign; ! dict_T *d; FOR_ALL_SIGNS_IN_BUF(buf, sign) { --- 1694,1701 ---- void get_buffer_signs(buf_T *buf, list_T *l) { ! sign_entry_T *sign; ! dict_T *d; FOR_ALL_SIGNS_IN_BUF(buf, sign) { *************** *** 1715,1724 **** char_u *sign_group, list_T *retlist) { ! dict_T *d; ! list_T *l; ! signlist_T *sign; ! dict_T *sdict; if ((d = dict_alloc_id(aid_sign_getplaced_dict)) == NULL) return; --- 1715,1724 ---- char_u *sign_group, list_T *retlist) { ! dict_T *d; ! list_T *l; ! sign_entry_T *sign; ! dict_T *sdict; if ((d = dict_alloc_id(aid_sign_getplaced_dict)) == NULL) return; *************** *** 1735,1743 **** if (!sign_in_group(sign, sign_group)) continue; if ((lnum == 0 && sign_id == 0) ! || (sign_id == 0 && lnum == sign->lnum) ! || (lnum == 0 && sign_id == sign->id) ! || (lnum == sign->lnum && sign_id == sign->id)) { if ((sdict = sign_get_info(sign)) != NULL) list_append_dict(l, sdict); --- 1735,1743 ---- if (!sign_in_group(sign, sign_group)) continue; if ((lnum == 0 && sign_id == 0) ! || (sign_id == 0 && lnum == sign->se_lnum) ! || (lnum == 0 && sign_id == sign->se_id) ! || (lnum == sign->se_lnum && sign_id == sign->se_id)) { if ((sdict = sign_get_info(sign)) != NULL) list_append_dict(l, sdict); *** ../vim-8.1.2204/src/globals.h 2019-10-17 22:58:59.070496999 +0200 --- src/globals.h 2019-10-24 14:32:22.622773855 +0200 *************** *** 676,682 **** // Iterate through all the signs placed in a buffer #define FOR_ALL_SIGNS_IN_BUF(buf, sign) \ ! for (sign = buf->b_signlist; sign != NULL; sign = sign->next) // Flag that is set when switching off 'swapfile'. It means that all blocks // are to be loaded into memory. Shouldn't be global... --- 676,682 ---- // Iterate through all the signs placed in a buffer #define FOR_ALL_SIGNS_IN_BUF(buf, sign) \ ! for (sign = buf->b_signlist; sign != NULL; sign = sign->se_next) // Flag that is set when switching off 'swapfile'. It means that all blocks // are to be loaded into memory. Shouldn't be global... *** ../vim-8.1.2204/src/drawline.c 2019-10-20 13:16:18.639042106 +0200 --- src/drawline.c 2019-10-24 14:53:29.004833439 +0200 *************** *** 121,129 **** #endif ) { ! text_sign = (sattr->text != NULL) ? sattr->typenr : 0; # ifdef FEAT_SIGN_ICONS ! icon_sign = (sattr->icon != NULL) ? sattr->typenr : 0; if (gui.in_use && icon_sign != 0) { // Use the image in this position. --- 121,129 ---- #endif ) { ! text_sign = (sattr->sat_text != NULL) ? sattr->sat_typenr : 0; # ifdef FEAT_SIGN_ICONS ! icon_sign = (sattr->sat_icon != NULL) ? sattr->sat_typenr : 0; if (gui.in_use && icon_sign != 0) { // Use the image in this position. *************** *** 158,164 **** # endif if (text_sign != 0) { ! *pp_extra = sattr->text; if (*pp_extra != NULL) { if (nrcol) --- 158,164 ---- # endif if (text_sign != 0) { ! *pp_extra = sattr->sat_text; if (*pp_extra != NULL) { if (nrcol) *************** *** 176,182 **** *c_finalp = NUL; *n_extrap = (int)STRLEN(*pp_extra); } ! *char_attrp = sattr->texthl; } } } --- 176,182 ---- *c_finalp = NUL; *n_extrap = (int)STRLEN(*pp_extra); } ! *char_attrp = sattr->sat_texthl; } } } *************** *** 597,603 **** } // Check if the character under the cursor should not be inverted ! if (!highlight_match && lnum == curwin->w_cursor.lnum && wp == curwin #ifdef FEAT_GUI && !gui.in_use #endif --- 597,604 ---- } // Check if the character under the cursor should not be inverted ! if (!highlight_match && lnum == curwin->w_cursor.lnum ! && wp == curwin #ifdef FEAT_GUI && !gui.in_use #endif *************** *** 677,683 **** # ifdef FEAT_SIGNS // If this line has a sign with line highlighting set line_attr. if (sign_present) ! line_attr = sattr.linehl; # endif # if defined(FEAT_QUICKFIX) // Highlight the current line in the quickfix window. --- 678,684 ---- # ifdef FEAT_SIGNS // If this line has a sign with line highlighting set line_attr. if (sign_present) ! line_attr = sattr.sat_linehl; # endif # if defined(FEAT_QUICKFIX) // Highlight the current line in the quickfix window. *** ../vim-8.1.2204/src/version.c 2019-10-23 23:16:41.661953347 +0200 --- src/version.c 2019-10-24 14:56:57.703877503 +0200 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2205, /**/ -- CRONE: Who sent you? ARTHUR: The Knights Who Say GNU! CRONE: Aaaagh! (she looks around in rear) No! We have no licenses here. "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///