To: vim_dev@googlegroups.com Subject: Patch 8.1.0658 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0658 Problem: Deleting signs and completion for :sign is insufficient. Solution: Add deleting signs in a specified or any group from the current cursor location. Add group and priority to sign command completion. Add tests for different sign unplace commands. Update help text. Add tests for sign jump with group. Update help for sign jump. (Yegappan Lakshmanan, closes #3731) Files: runtime/doc/sign.txt, src/buffer.c, src/evalfunc.c, src/ex_cmds.c, src/netbeans.c, src/proto/buffer.pro, src/proto/ex_cmds.pro, src/testdir/test_signs.vim *** ../vim-8.1.0657/runtime/doc/sign.txt 2018-12-21 15:16:57.475579814 +0100 --- runtime/doc/sign.txt 2018-12-29 18:36:00.268781805 +0100 *************** *** 251,263 **** all the files it appears in. :sign unplace * ! Remove all placed signs in the global group. :sign unplace * group=* ! Remove all placed signs in all the groups. :sign unplace ! Remove the placed sign at the cursor position. LISTING PLACED SIGNS *:sign-place-list* --- 251,274 ---- all the files it appears in. :sign unplace * ! Remove placed signs in the global group from all the files. ! ! :sign unplace * group={group} ! Remove placed signs in group {group} from all the files. :sign unplace * group=* ! Remove placed signs in all the groups from all the files. :sign unplace ! Remove a placed sign at the cursor position. If multiple signs ! are placed in the line, then only one is removed. ! ! :sign unplace group={group} ! Remove a placed sign in group {group} at the cursor ! position. ! ! :sign unplace group=* ! Remove a placed sign in any group at the cursor position. LISTING PLACED SIGNS *:sign-place-list* *************** *** 271,286 **** :sign place group={group} file={fname} List signs in group {group} placed in file {fname}. :sign place buffer={nr} List signs placed in buffer {nr}. :sign place group={group} buffer={nr} List signs in group {group} placed in buffer {nr}. ! :sign place List placed signs in all files. :sign place group={group} ! List placed signs in all sign groups in all the files. JUMPING TO A SIGN *:sign-jump* *E157* --- 282,306 ---- :sign place group={group} file={fname} List signs in group {group} placed in file {fname}. + :sign place group=* file={fname} + List signs in all the groups placed in file {fname}. + :sign place buffer={nr} List signs placed in buffer {nr}. :sign place group={group} buffer={nr} List signs in group {group} placed in buffer {nr}. ! :sign place group=* buffer={nr} ! List signs in all the groups placed in buffer {nr}. ! ! :sign place List placed signs in the global group in all files. :sign place group={group} ! List placed signs with sign group {group} in all files. ! ! :sign place group=* ! List placed signs in all sign groups in all files. JUMPING TO A SIGN *:sign-jump* *E157* *************** *** 292,300 **** --- 312,326 ---- If the file isn't displayed in window and the current file can not be |abandon|ed this fails. + :sign jump {id} group={group} file={fname} + Same but jump to the sign in group {group} + :sign jump {id} buffer={nr} *E934* Same, but use buffer {nr}. This fails if buffer {nr} does not have a name. + :sign jump {id} group={group} buffer={nr} + Same but jump to the sign in group {group} + vim:tw=78:ts=8:noet:ft=help:norl: *** ../vim-8.1.0657/src/buffer.c 2018-12-27 00:28:27.497299324 +0100 --- src/buffer.c 2018-12-29 18:38:43.291325605 +0100 *************** *** 6077,6086 **** 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)); } /* --- 6077,6086 ---- 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)); } /* *************** *** 6207,6212 **** --- 6207,6213 ---- linenr_T buf_delsign( buf_T *buf, // buffer sign is stored in + linenr_T atlnum, // sign at this line, 0 - at any line int id, // sign id char_u *group) // sign group { *************** *** 6220,6226 **** for (sign = buf->b_signlist; sign != NULL; sign = next) { next = sign->next; ! if ((id == 0 || sign->id == id) && sign_in_group(sign, group)) { *lastp = next; --- 6221,6229 ---- 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; *************** *** 6230,6237 **** if (sign->group != NULL) sign_group_unref(sign->group->sg_name); vim_free(sign); // Check whether only one sign needs to be deleted ! if (group == NULL || (*group != '*' && id != 0)) break; } else --- 6233,6246 ---- if (sign->group != NULL) sign_group_unref(sign->group->sg_name); vim_free(sign); + update_debug_sign(buf, lnum); // Check whether only one sign needs to be deleted ! // If deleting a sign with a specific identifer in a particular ! // group or deleting any sign at a particular line number, delete ! // only one sign. ! if (group == NULL ! || (*group != '*' && id != 0) ! || (*group == '*' && atlnum != 0)) break; } else *************** *** 6272,6288 **** /* * Return the sign at line 'lnum' in buffer 'buf'. Returns NULL if a sign is ! * not found at the line. */ static signlist_T * buf_getsign_at_line( buf_T *buf, // buffer whose sign we are searching for ! linenr_T lnum) // line number of sign { signlist_T *sign; // a sign in the signlist FOR_ALL_SIGNS_IN_BUF(buf, sign) ! if (sign->lnum == lnum) return sign; return NULL; --- 6281,6298 ---- /* * 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 && sign_in_group(sign, groupname)) return sign; return NULL; *************** *** 6312,6322 **** int buf_findsign_id( buf_T *buf, // buffer whose sign we are searching for ! linenr_T lnum) // line number of sign { signlist_T *sign; // a sign in the signlist ! sign = buf_getsign_at_line(buf, lnum); if (sign != NULL) return sign->id; --- 6322,6333 ---- int buf_findsign_id( 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 ! sign = buf_getsign_at_line(buf, lnum, groupname); if (sign != NULL) return sign->id; *************** *** 6401,6416 **** } /* ! * Delete all signs in all buffers. */ void ! buf_delete_all_signs(void) { buf_T *buf; /* buffer we are checking for signs */ FOR_ALL_BUFFERS(buf) if (buf->b_signlist != NULL) ! buf_delete_signs(buf, (char_u *)"*"); } /* --- 6412,6427 ---- } /* ! * Delete all the signs in the specified group in all the buffers. */ void ! buf_delete_all_signs(char_u *groupname) { buf_T *buf; /* buffer we are checking for signs */ FOR_ALL_BUFFERS(buf) if (buf->b_signlist != NULL) ! buf_delete_signs(buf, groupname); } /* *** ../vim-8.1.0657/src/evalfunc.c 2018-12-27 23:44:34.797953474 +0100 --- src/evalfunc.c 2018-12-29 18:36:00.272781771 +0100 *************** *** 11600,11611 **** { // Delete the sign in all the buffers FOR_ALL_BUFFERS(buf) ! if (sign_unplace(sign_id, group, buf) == OK) rettv->vval.v_number = 0; } else { ! if (sign_unplace(sign_id, group, buf) == OK) rettv->vval.v_number = 0; } vim_free(group); --- 11600,11611 ---- { // Delete the sign in all the buffers FOR_ALL_BUFFERS(buf) ! if (sign_unplace(sign_id, group, buf, 0) == OK) rettv->vval.v_number = 0; } else { ! if (sign_unplace(sign_id, group, buf, 0) == OK) rettv->vval.v_number = 0; } vim_free(group); *** ../vim-8.1.0657/src/ex_cmds.c 2018-12-27 00:28:27.497299324 +0100 --- src/ex_cmds.c 2018-12-29 18:36:00.272781771 +0100 *************** *** 7895,7901 **** * Unplace the specified sign */ int ! sign_unplace(int sign_id, char_u *sign_group, buf_T *buf) { if (sign_id == 0) { --- 7895,7901 ---- * Unplace the specified sign */ int ! sign_unplace(int sign_id, char_u *sign_group, buf_T *buf, linenr_T atlnum) { if (sign_id == 0) { *************** *** 7908,7923 **** linenr_T lnum; // Delete only the specified signs ! lnum = buf_delsign(buf, sign_id, sign_group); if (lnum == 0) return FAIL; - update_debug_sign(buf, lnum); } return OK; } /* * ":sign" command */ void --- 7908,7937 ---- linenr_T lnum; // Delete only the specified signs ! lnum = buf_delsign(buf, atlnum, sign_id, sign_group); if (lnum == 0) return FAIL; } return OK; } /* + * Unplace the sign at the current cursor line. + */ + static void + sign_unplace_at_cursor(char_u *groupname) + { + int id = -1; + + id = buf_findsign_id(curwin->w_buffer, curwin->w_cursor.lnum, groupname); + if (id > 0) + sign_unplace(id, groupname, curwin->w_buffer, curwin->w_cursor.lnum); + else + EMSG(_("E159: Missing sign number")); + } + + /* * ":sign" command */ void *************** *** 8047,8060 **** sign_list_placed(NULL, NULL); } else if (idx == SIGNCMD_UNPLACE) - { /* ":sign unplace": remove placed sign at cursor */ ! id = buf_findsign_id(curwin->w_buffer, curwin->w_cursor.lnum); ! if (id > 0) ! sign_unplace(id, NULL, curwin->w_buffer); ! else ! EMSG(_("E159: Missing sign number")); ! } else EMSG(_(e_argreq)); return; --- 8061,8068 ---- sign_list_placed(NULL, NULL); } else if (idx == SIGNCMD_UNPLACE) /* ":sign unplace": remove placed sign at cursor */ ! sign_unplace_at_cursor(NULL); else EMSG(_(e_argreq)); return; *************** *** 8063,8069 **** if (idx == SIGNCMD_UNPLACE && arg[0] == '*' && arg[1] == NUL) { /* ":sign unplace *": remove all placed signs */ ! buf_delete_all_signs(); return; } --- 8071,8077 ---- if (idx == SIGNCMD_UNPLACE && arg[0] == '*' && arg[1] == NUL) { /* ":sign unplace *": remove all placed signs */ ! buf_delete_all_signs(NULL); return; } *************** *** 8084,8090 **** { /* ":sign unplace {id}": remove placed sign by number */ FOR_ALL_BUFFERS(buf) ! sign_unplace(id, NULL, buf); return; } } --- 8092,8098 ---- { /* ":sign unplace {id}": remove placed sign by number */ FOR_ALL_BUFFERS(buf) ! sign_unplace(id, NULL, buf, 0); return; } } *************** *** 8183,8189 **** } else if (idx == SIGNCMD_JUMP) { ! /* ":sign jump {id} file={fname}" */ if (lnum >= 0 || sign_name != NULL || buf == NULL) EMSG(_(e_invarg)); else if ((lnum = buf_findsign(buf, id, group)) > 0) --- 8191,8198 ---- } else if (idx == SIGNCMD_JUMP) { ! // ":sign jump {id} file={fname}" ! // ":sign jump {id} group={group} file={fname}" if (lnum >= 0 || sign_name != NULL || buf == NULL) EMSG(_(e_invarg)); else if ((lnum = buf_findsign(buf, id, group)) > 0) *************** *** 8225,8231 **** { if (buf != NULL) // ":sign unplace * file={fname}" ! sign_unplace(0, group, buf); else // ":sign unplace * group=*": remove all placed signs FOR_ALL_BUFFERS(buf) --- 8234,8240 ---- { if (buf != NULL) // ":sign unplace * file={fname}" ! sign_unplace(0, group, buf, 0); else // ":sign unplace * group=*": remove all placed signs FOR_ALL_BUFFERS(buf) *************** *** 8238,8251 **** // ":sign unplace {id} file={fname}" // ":sign unplace {id} group={group} file={fname}" // ":sign unplace {id} group=* file={fname}" ! sign_unplace(id, group, buf); else ! // ":sign unplace {id} group={group}": ! // ":sign unplace {id} group=*": ! // remove all placed signs in this group. ! FOR_ALL_BUFFERS(buf) ! if (buf->b_signlist != NULL) ! sign_unplace(id, group, buf); } } /* idx == SIGNCMD_PLACE */ --- 8247,8272 ---- // ":sign unplace {id} file={fname}" // ":sign unplace {id} group={group} file={fname}" // ":sign unplace {id} group=* file={fname}" ! sign_unplace(id, group, buf, 0); else ! { ! if (id == -1) ! { ! // ":sign unplace group={group}": ! // ":sign unplace group=*": ! // remove sign in the current line in specified group ! sign_unplace_at_cursor(group); ! } ! else ! { ! // ":sign unplace {id} group={group}": ! // ":sign unplace {id} group=*": ! // remove all placed signs in this group. ! FOR_ALL_BUFFERS(buf) ! if (buf->b_signlist != NULL) ! sign_unplace(id, group, buf, 0); ! } ! } } } /* idx == SIGNCMD_PLACE */ *************** *** 8581,8593 **** { char *place_arg[] = { ! "line=", "name=", "file=", "buffer=", NULL }; return (char_u *)place_arg[idx]; } case EXP_UNPLACE: { ! char *unplace_arg[] = { "file=", "buffer=", NULL }; return (char_u *)unplace_arg[idx]; } case EXP_SIGN_NAMES: --- 8602,8615 ---- { char *place_arg[] = { ! "line=", "name=", "group=", "priority=", "file=", ! "buffer=", NULL }; return (char_u *)place_arg[idx]; } case EXP_UNPLACE: { ! char *unplace_arg[] = { "group=", "file=", "buffer=", NULL }; return (char_u *)unplace_arg[idx]; } case EXP_SIGN_NAMES: *** ../vim-8.1.0657/src/netbeans.c 2018-12-21 15:16:57.479579788 +0100 --- src/netbeans.c 2018-12-29 18:36:00.272781771 +0100 *************** *** 1251,1262 **** /* delete signs from the lines being deleted */ for (i = del_from_lnum; i <= del_to_lnum; i++) { ! int id = buf_findsign_id(buf->bufp, (linenr_T)i); if (id > 0) { nbdebug((" Deleting sign %d on line %d\n", id, i)); ! buf_delsign(buf->bufp, id, NULL); } else { --- 1251,1262 ---- /* delete signs from the lines being deleted */ for (i = del_from_lnum; i <= del_to_lnum; i++) { ! int id = buf_findsign_id(buf->bufp, (linenr_T)i, NULL); if (id > 0) { nbdebug((" Deleting sign %d on line %d\n", id, i)); ! buf_delsign(buf->bufp, 0, id, NULL); } else { *** ../vim-8.1.0657/src/proto/buffer.pro 2018-12-27 00:28:27.501299292 +0100 --- src/proto/buffer.pro 2018-12-29 18:40:08.310566333 +0100 *************** *** 69,91 **** void switch_to_win_for_buf(buf_T *buf, win_T **save_curwinp, tabpage_T **save_curtabp, bufref_T *save_curbuf); void restore_win_for_buf(win_T *save_curwin, tabpage_T *save_curtab, bufref_T *save_curbuf); int find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp); - void buf_addsign(buf_T *buf, int id, char_u *group, int prio, linenr_T lnum, int typenr); - linenr_T buf_change_sign_type(buf_T *buf, int markId, char_u *group, int typenr); - int buf_getsigntype(buf_T *buf, linenr_T lnum, int type); - linenr_T buf_delsign(buf_T *buf, int id, char_u *group); - int buf_findsign(buf_T *buf, int id, char_u *group); - #ifdef FEAT_SIGNS void init_signs(void); int sign_group_get_next_signid(buf_T *buf, char_u *groupname); int sign_in_group(signlist_T *sign, char_u *group); dict_T *sign_get_info(signlist_T *sign); signlist_T *buf_getsign_with_id(buf_T *buf, int id, char_u *group); ! #endif ! int buf_findsign_id(buf_T *buf, linenr_T lnum); int buf_findsigntype_id(buf_T *buf, linenr_T lnum, int typenr); int buf_signcount(buf_T *buf, linenr_T lnum); void buf_delete_signs(buf_T *buf, char_u *group); ! void buf_delete_all_signs(void); void sign_list_placed(buf_T *rbuf, char_u *sign_group); void sign_mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after); void set_buflisted(int on); --- 69,89 ---- void switch_to_win_for_buf(buf_T *buf, win_T **save_curwinp, tabpage_T **save_curtabp, bufref_T *save_curbuf); void restore_win_for_buf(win_T *save_curwin, tabpage_T *save_curtab, bufref_T *save_curbuf); int find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp); void init_signs(void); int sign_group_get_next_signid(buf_T *buf, char_u *groupname); int sign_in_group(signlist_T *sign, char_u *group); dict_T *sign_get_info(signlist_T *sign); + void buf_addsign(buf_T *buf, int id, char_u *groupname, int prio, linenr_T lnum, int typenr); + linenr_T buf_change_sign_type(buf_T *buf, int markId, char_u *group, int typenr); + int buf_getsigntype(buf_T *buf, linenr_T lnum, int type); + linenr_T buf_delsign(buf_T *buf, linenr_T atlnum, int id, char_u *group); + int buf_findsign(buf_T *buf, int id, char_u *group); signlist_T *buf_getsign_with_id(buf_T *buf, int id, char_u *group); ! int buf_findsign_id(buf_T *buf, linenr_T lnum, char_u *groupname); int buf_findsigntype_id(buf_T *buf, linenr_T lnum, int typenr); int buf_signcount(buf_T *buf, linenr_T lnum); void buf_delete_signs(buf_T *buf, char_u *group); ! void buf_delete_all_signs(char_u *groupname); void sign_list_placed(buf_T *rbuf, char_u *sign_group); void sign_mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after); void set_buflisted(int on); *** ../vim-8.1.0657/src/proto/ex_cmds.pro 2018-12-21 15:16:57.479579788 +0100 --- src/proto/ex_cmds.pro 2018-12-29 18:40:16.218495713 +0100 *************** *** 54,77 **** void ex_exusage(exarg_T *eap); void ex_viusage(exarg_T *eap); void ex_helptags(exarg_T *eap); void ex_sign(exarg_T *eap); void sign_gui_started(void); int sign_get_attr(int typenr, int line); char_u *sign_get_text(int typenr); void *sign_get_image(int typenr); char_u *sign_typenr2name(int typenr); void free_signs(void); - void free_signs(void); char_u *get_sign_name(expand_T *xp, int idx); void set_context_in_sign_cmd(expand_T *xp, char_u *arg); void ex_smile(exarg_T *eap); void ex_drop(exarg_T *eap); char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags); void ex_oldfiles(exarg_T *eap); - int sign_define_by_name(char_u *name, char_u *icon, char_u *linehl, char_u *text, char_u *texthl); - int sign_undefine_by_name(char_u *name); - void sign_getlist(char_u *name, list_T *retlist); - int sign_place(int *sign_id, char_u *group, char_u *sign_name, buf_T *buf, linenr_T lnum, int prio); - int sign_unplace(int id, char_u *group, buf_T *buf); - void sign_get_placed(buf_T *buf, linenr_T lnum, int id, char_u *group, list_T *retlist); /* vim: set ft=c : */ --- 54,76 ---- void ex_exusage(exarg_T *eap); void ex_viusage(exarg_T *eap); void ex_helptags(exarg_T *eap); + int sign_define_by_name(char_u *name, char_u *icon, char_u *linehl, char_u *text, char_u *texthl); + int sign_undefine_by_name(char_u *name); + int sign_place(int *sign_id, char_u *sign_group, char_u *sign_name, buf_T *buf, linenr_T lnum, int prio); + int sign_unplace(int sign_id, char_u *sign_group, buf_T *buf, linenr_T atlnum); void ex_sign(exarg_T *eap); + void sign_getlist(char_u *name, list_T *retlist); + void sign_get_placed(buf_T *buf, linenr_T lnum, int sign_id, char_u *sign_group, list_T *retlist); void sign_gui_started(void); int sign_get_attr(int typenr, int line); char_u *sign_get_text(int typenr); void *sign_get_image(int typenr); char_u *sign_typenr2name(int typenr); void free_signs(void); char_u *get_sign_name(expand_T *xp, int idx); void set_context_in_sign_cmd(expand_T *xp, char_u *arg); void ex_smile(exarg_T *eap); void ex_drop(exarg_T *eap); char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags); void ex_oldfiles(exarg_T *eap); /* vim: set ft=c : */ *** ../vim-8.1.0657/src/testdir/test_signs.vim 2018-12-27 00:28:27.501299292 +0100 --- src/testdir/test_signs.vim 2018-12-29 18:36:00.272781771 +0100 *************** *** 28,35 **** let a=execute('sign list Sign1') call assert_equal("\nsign Sign1 text=x ", a) ! " Split the window to the bottom to verify sign jump will stay in the current window ! " if the buffer is displayed there. let bn = bufnr('%') let wn = winnr() exe 'sign place 41 line=3 name=Sign1 buffer=' . bn --- 28,35 ---- let a=execute('sign list Sign1') call assert_equal("\nsign Sign1 text=x ", a) ! " Split the window to the bottom to verify sign jump will stay in the ! " current window if the buffer is displayed there. let bn = bufnr('%') let wn = winnr() exe 'sign place 41 line=3 name=Sign1 buffer=' . bn *************** *** 211,229 **** call assert_equal('"sign undefine Sign1 Sign2', @:) call feedkeys(":sign place 1 \\\"\", 'tx') ! call assert_equal('"sign place 1 buffer= file= line= name=', @:) call feedkeys(":sign place 1 name=\\\"\", 'tx') call assert_equal('"sign place 1 name=Sign1 Sign2', @:) call feedkeys(":sign unplace 1 \\\"\", 'tx') ! call assert_equal('"sign unplace 1 buffer= file=', @:) call feedkeys(":sign list \\\"\", 'tx') call assert_equal('"sign list Sign1 Sign2', @:) call feedkeys(":sign jump 1 \\\"\", 'tx') ! call assert_equal('"sign jump 1 buffer= file=', @:) sign undefine Sign1 sign undefine Sign2 --- 211,230 ---- call assert_equal('"sign undefine Sign1 Sign2', @:) call feedkeys(":sign place 1 \\\"\", 'tx') ! call assert_equal('"sign place 1 buffer= file= group= line= name= priority=', ! \ @:) call feedkeys(":sign place 1 name=\\\"\", 'tx') call assert_equal('"sign place 1 name=Sign1 Sign2', @:) call feedkeys(":sign unplace 1 \\\"\", 'tx') ! call assert_equal('"sign unplace 1 buffer= file= group=', @:) call feedkeys(":sign list \\\"\", 'tx') call assert_equal('"sign list Sign1 Sign2', @:) call feedkeys(":sign jump 1 \\\"\", 'tx') ! call assert_equal('"sign jump 1 buffer= file= group=', @:) sign undefine Sign1 sign undefine Sign2 *************** *** 449,455 **** edit Xsign let bnum = bufnr('%') - let fname = fnamemodify('Xsign', ':p') " Error case call assert_fails("call sign_place(5, [], 'sign1', 'Xsign', --- 450,455 ---- *************** *** 466,471 **** --- 466,475 ---- let s = sign_getplaced('Xsign') call assert_equal(1, len(s[0].signs)) call assert_equal(s[0].signs[0].group, '') + let s = sign_getplaced(bnum, {'group' : ''}) + call assert_equal([{'id' : 5, 'group' : '', 'name' : 'sign1', 'lnum' : 10, + \ 'priority' : 10}], s[0].signs) + call assert_equal(1, len(s[0].signs)) let s = sign_getplaced(bnum, {'group' : 'g2'}) call assert_equal('g2', s[0].signs[0].group) let s = sign_getplaced(bnum, {'group' : 'g3'}) *************** *** 584,717 **** sign place 5 group=g1 line=10 name=sign1 file=Xsign sign place 5 group=g2 line=10 name=sign1 file=Xsign ! " Test for :sign place group={group} file={fname} let a = execute('sign place file=Xsign') call assert_equal("\n--- Signs ---\nSigns for Xsign:\n line=10 id=5 name=sign1 priority=10\n", a) let a = execute('sign place group=g2 file=Xsign') call assert_equal("\n--- Signs ---\nSigns for Xsign:\n line=10 id=5 group=g2 name=sign1 priority=10\n", a) let a = execute('sign place group=* file=Xsign') call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . \ " line=10 id=5 group=g2 name=sign1 priority=10\n" . \ " line=10 id=5 group=g1 name=sign1 priority=10\n" . \ " line=10 id=5 name=sign1 priority=10\n", a) let a = execute('sign place group=xyz file=Xsign') call assert_equal("\n--- Signs ---\nSigns for Xsign:\n", a) call sign_unplace('*') - - " Test for :sign place group={group} buffer={nr} let bnum = bufnr('Xsign') exe 'sign place 5 line=10 name=sign1 buffer=' . bnum exe 'sign place 5 group=g1 line=11 name=sign1 buffer=' . bnum exe 'sign place 5 group=g2 line=12 name=sign1 buffer=' . bnum let a = execute('sign place buffer=' . bnum) call assert_equal("\n--- Signs ---\nSigns for Xsign:\n line=10 id=5 name=sign1 priority=10\n", a) let a = execute('sign place group=g2 buffer=' . bnum) call assert_equal("\n--- Signs ---\nSigns for Xsign:\n line=12 id=5 group=g2 name=sign1 priority=10\n", a) let a = execute('sign place group=* buffer=' . bnum) call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . \ " line=10 id=5 name=sign1 priority=10\n" . \ " line=11 id=5 group=g1 name=sign1 priority=10\n" . \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a) let a = execute('sign place group=xyz buffer=' . bnum) call assert_equal("\n--- Signs ---\nSigns for Xsign:\n", a) let a = execute('sign place group=*') call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . \ " line=10 id=5 name=sign1 priority=10\n" . \ " line=11 id=5 group=g1 name=sign1 priority=10\n" . \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a) ! " Test for :sign unplace ! sign unplace 5 group=g2 file=Xsign ! call assert_equal([], sign_getplaced(bnum, {'group' : 'g2'})[0].signs) ! ! exe 'sign unplace 5 group=g1 buffer=' . bnum ! call assert_equal([], sign_getplaced(bnum, {'group' : 'g1'})[0].signs) ! ! sign unplace 5 group=xy file=Xsign ! call assert_equal(1, len(sign_getplaced(bnum, {'group' : '*'})[0].signs)) ! ! " Test for removing all the signs. Place the signs again for this test ! sign place 5 group=g1 line=11 name=sign1 file=Xsign ! sign place 5 group=g2 line=12 name=sign1 file=Xsign ! sign place 6 line=20 name=sign1 file=Xsign ! sign place 6 group=g1 line=21 name=sign1 file=Xsign ! sign place 6 group=g2 line=22 name=sign1 file=Xsign ! sign unplace 5 group=* file=Xsign ! let a = execute('sign place group=*') ! call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . ! \ " line=20 id=6 name=sign1 priority=10\n" . ! \ " line=21 id=6 group=g1 name=sign1 priority=10\n" . ! \ " line=22 id=6 group=g2 name=sign1 priority=10\n", a) ! " Remove all the signs from the global group ! sign unplace * file=Xsign ! let a = execute('sign place group=*') ! call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . ! \ " line=21 id=6 group=g1 name=sign1 priority=10\n" . ! \ " line=22 id=6 group=g2 name=sign1 priority=10\n", a) ! " Remove all the signs from a particular group ! sign place 5 line=10 name=sign1 file=Xsign ! sign place 5 group=g1 line=11 name=sign1 file=Xsign ! sign place 5 group=g2 line=12 name=sign1 file=Xsign ! sign unplace * group=g1 file=Xsign ! let a = execute('sign place group=*') ! call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . ! \ " line=10 id=5 name=sign1 priority=10\n" . ! \ " line=12 id=5 group=g2 name=sign1 priority=10\n" . ! \ " line=22 id=6 group=g2 name=sign1 priority=10\n", a) ! " Remove all the signs from all the groups in a file ! sign place 5 group=g1 line=11 name=sign1 file=Xsign ! sign place 6 line=20 name=sign1 file=Xsign ! sign place 6 group=g1 line=21 name=sign1 file=Xsign ! sign unplace * group=* file=Xsign ! let a = execute('sign place group=*') ! call assert_equal("\n--- Signs ---\n", a) ! " Remove a particular sign id in a group from all the files ! sign place 5 group=g1 line=11 name=sign1 file=Xsign ! sign unplace 5 group=g1 ! let a = execute('sign place group=*') ! call assert_equal("\n--- Signs ---\n", a) ! " Remove a particular sign id in all the groups from all the files ! sign place 5 line=10 name=sign1 file=Xsign ! sign place 5 group=g1 line=11 name=sign1 file=Xsign ! sign place 5 group=g2 line=12 name=sign1 file=Xsign ! sign place 6 line=20 name=sign1 file=Xsign ! sign place 6 group=g1 line=21 name=sign1 file=Xsign ! sign place 6 group=g2 line=22 name=sign1 file=Xsign sign unplace 5 group=* ! let a = execute('sign place group=*') ! call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . ! \ " line=20 id=6 name=sign1 priority=10\n" . ! \ " line=21 id=6 group=g1 name=sign1 priority=10\n" . ! \ " line=22 id=6 group=g2 name=sign1 priority=10\n", a) ! " Remove all the signs from all the groups in all the files ! sign place 5 line=10 name=sign1 file=Xsign ! sign place 5 group=g1 line=11 name=sign1 file=Xsign sign unplace * group=* ! let a = execute('sign place group=*') ! call assert_equal("\n--- Signs ---\n", a) ! " Error cases ! call assert_fails("sign place 3 group= name=sign1 buffer=" . bnum, 'E474:') - call delete("Xsign") call sign_unplace('*') call sign_undefine() enew | only endfunc " Tests for auto-generating the sign identifier --- 588,1021 ---- sign place 5 group=g1 line=10 name=sign1 file=Xsign sign place 5 group=g2 line=10 name=sign1 file=Xsign ! " Tests for the ':sign place' command ! ! " :sign place file={fname} let a = execute('sign place file=Xsign') call assert_equal("\n--- Signs ---\nSigns for Xsign:\n line=10 id=5 name=sign1 priority=10\n", a) + " :sign place group={group} file={fname} let a = execute('sign place group=g2 file=Xsign') call assert_equal("\n--- Signs ---\nSigns for Xsign:\n line=10 id=5 group=g2 name=sign1 priority=10\n", a) + " :sign place group=* file={fname} let a = execute('sign place group=* file=Xsign') call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . \ " line=10 id=5 group=g2 name=sign1 priority=10\n" . \ " line=10 id=5 group=g1 name=sign1 priority=10\n" . \ " line=10 id=5 name=sign1 priority=10\n", a) + " Error case: non-existing group let a = execute('sign place group=xyz file=Xsign') call assert_equal("\n--- Signs ---\nSigns for Xsign:\n", a) call sign_unplace('*') let bnum = bufnr('Xsign') exe 'sign place 5 line=10 name=sign1 buffer=' . bnum exe 'sign place 5 group=g1 line=11 name=sign1 buffer=' . bnum exe 'sign place 5 group=g2 line=12 name=sign1 buffer=' . bnum + " :sign place buffer={fname} let a = execute('sign place buffer=' . bnum) call assert_equal("\n--- Signs ---\nSigns for Xsign:\n line=10 id=5 name=sign1 priority=10\n", a) + " :sign place group={group} buffer={fname} let a = execute('sign place group=g2 buffer=' . bnum) call assert_equal("\n--- Signs ---\nSigns for Xsign:\n line=12 id=5 group=g2 name=sign1 priority=10\n", a) + " :sign place group=* buffer={fname} let a = execute('sign place group=* buffer=' . bnum) call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . \ " line=10 id=5 name=sign1 priority=10\n" . \ " line=11 id=5 group=g1 name=sign1 priority=10\n" . \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a) + " Error case: non-existing group let a = execute('sign place group=xyz buffer=' . bnum) call assert_equal("\n--- Signs ---\nSigns for Xsign:\n", a) + " :sign place + let a = execute('sign place') + call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . + \ " line=10 id=5 name=sign1 priority=10\n", a) + + " :sign place group={group} + let a = execute('sign place group=g1') + call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . + \ " line=11 id=5 group=g1 name=sign1 priority=10\n", a) + + " :sign place group=* let a = execute('sign place group=*') call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . \ " line=10 id=5 name=sign1 priority=10\n" . \ " line=11 id=5 group=g1 name=sign1 priority=10\n" . \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a) ! " Test for ':sign jump' command with groups ! sign jump 5 group=g1 file=Xsign ! call assert_equal(11, line('.')) ! call assert_equal('Xsign', bufname('')) ! sign jump 5 group=g2 file=Xsign ! call assert_equal(12, line('.')) ! " Error cases ! call assert_fails("sign place 3 group= name=sign1 buffer=" . bnum, 'E474:') ! call delete("Xsign") ! call sign_unplace('*') ! call sign_undefine() ! enew | only ! endfunc ! " Place signs used for ":sign unplace" command test ! func Place_signs_for_test() ! call sign_unplace('*') ! sign place 3 line=10 name=sign1 file=Xsign1 ! sign place 3 group=g1 line=11 name=sign1 file=Xsign1 ! sign place 3 group=g2 line=12 name=sign1 file=Xsign1 ! sign place 4 line=15 name=sign1 file=Xsign1 ! sign place 4 group=g1 line=16 name=sign1 file=Xsign1 ! sign place 4 group=g2 line=17 name=sign1 file=Xsign1 ! sign place 5 line=20 name=sign1 file=Xsign2 ! sign place 5 group=g1 line=21 name=sign1 file=Xsign2 ! sign place 5 group=g2 line=22 name=sign1 file=Xsign2 ! sign place 6 line=25 name=sign1 file=Xsign2 ! sign place 6 group=g1 line=26 name=sign1 file=Xsign2 ! sign place 6 group=g2 line=27 name=sign1 file=Xsign2 ! endfunc ! " Place multiple signs in a single line for test ! func Place_signs_at_line_for_test() ! call sign_unplace('*') ! sign place 3 line=13 name=sign1 file=Xsign1 ! sign place 3 group=g1 line=13 name=sign1 file=Xsign1 ! sign place 3 group=g2 line=13 name=sign1 file=Xsign1 ! sign place 4 line=13 name=sign1 file=Xsign1 ! sign place 4 group=g1 line=13 name=sign1 file=Xsign1 ! sign place 4 group=g2 line=13 name=sign1 file=Xsign1 ! endfunc ! ! " Tests for the ':sign unplace' command ! func Test_sign_unplace() ! enew | only ! " Remove all the signs ! call sign_unplace('*') ! call sign_undefine() ! ! " Create two files and define signs ! call writefile(repeat(["Sun is shining"], 30), "Xsign1") ! call writefile(repeat(["It is beautiful"], 30), "Xsign2") ! ! let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'} ! call sign_define("sign1", attr) ! ! edit Xsign1 ! let bnum1 = bufnr('%') ! split Xsign2 ! let bnum2 = bufnr('%') ! ! let signs1 = [{'id' : 3, 'name' : 'sign1', 'lnum' : 10, 'group' : '', ! \ 'priority' : 10}, ! \ {'id' : 3, 'name' : 'sign1', 'lnum' : 11, 'group' : 'g1', ! \ 'priority' : 10}, ! \ {'id' : 3, 'name' : 'sign1', 'lnum' : 12, 'group' : 'g2', ! \ 'priority' : 10}, ! \ {'id' : 4, 'name' : 'sign1', 'lnum' : 15, 'group' : '', ! \ 'priority' : 10}, ! \ {'id' : 4, 'name' : 'sign1', 'lnum' : 16, 'group' : 'g1', ! \ 'priority' : 10}, ! \ {'id' : 4, 'name' : 'sign1', 'lnum' : 17, 'group' : 'g2', ! \ 'priority' : 10},] ! let signs2 = [{'id' : 5, 'name' : 'sign1', 'lnum' : 20, 'group' : '', ! \ 'priority' : 10}, ! \ {'id' : 5, 'name' : 'sign1', 'lnum' : 21, 'group' : 'g1', ! \ 'priority' : 10}, ! \ {'id' : 5, 'name' : 'sign1', 'lnum' : 22, 'group' : 'g2', ! \ 'priority' : 10}, ! \ {'id' : 6, 'name' : 'sign1', 'lnum' : 25, 'group' : '', ! \ 'priority' : 10}, ! \ {'id' : 6, 'name' : 'sign1', 'lnum' : 26, 'group' : 'g1', ! \ 'priority' : 10}, ! \ {'id' : 6, 'name' : 'sign1', 'lnum' : 27, 'group' : 'g2', ! \ 'priority' : 10},] ! ! " Test for :sign unplace {id} file={fname} ! call Place_signs_for_test() ! sign unplace 3 file=Xsign1 ! sign unplace 6 file=Xsign2 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 3 || val.group != ''}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.id != 6 || val.group != ''}), ! \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! ! " Test for :sign unplace {id} group={group} file={fname} ! call Place_signs_for_test() ! sign unplace 4 group=g1 file=Xsign1 ! sign unplace 5 group=g2 file=Xsign2 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 4 || val.group != 'g1'}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.id != 5 || val.group != 'g2'}), ! \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! ! " Test for :sign unplace {id} group=* file={fname} ! call Place_signs_for_test() ! sign unplace 3 group=* file=Xsign1 ! sign unplace 6 group=* file=Xsign2 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 3}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.id != 6}), ! \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! ! " Test for :sign unplace * file={fname} ! call Place_signs_for_test() ! sign unplace * file=Xsign1 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.group != ''}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal(signs2, sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! ! " Test for :sign unplace * group={group} file={fname} ! call Place_signs_for_test() ! sign unplace * group=g1 file=Xsign1 ! sign unplace * group=g2 file=Xsign2 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.group != 'g1'}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.group != 'g2'}), ! \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! ! " Test for :sign unplace * group=* file={fname} ! call Place_signs_for_test() ! sign unplace * group=* file=Xsign2 ! call assert_equal(signs1, sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal([], sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! ! " Test for :sign unplace {id} buffer={nr} ! call Place_signs_for_test() ! exe 'sign unplace 3 buffer=' . bnum1 ! exe 'sign unplace 6 buffer=' . bnum2 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 3 || val.group != ''}), ! \ sign_getplaced(bnum1, {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.id != 6 || val.group != ''}), ! \ sign_getplaced(bnum2, {'group' : '*'})[0].signs) ! ! " Test for :sign unplace {id} group={group} buffer={nr} ! call Place_signs_for_test() ! exe 'sign unplace 4 group=g1 buffer=' . bnum1 ! exe 'sign unplace 5 group=g2 buffer=' . bnum2 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 4 || val.group != 'g1'}), ! \ sign_getplaced(bnum1, {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.id != 5 || val.group != 'g2'}), ! \ sign_getplaced(bnum2, {'group' : '*'})[0].signs) ! ! " Test for :sign unplace {id} group=* buffer={nr} ! call Place_signs_for_test() ! exe 'sign unplace 3 group=* buffer=' . bnum1 ! exe 'sign unplace 6 group=* buffer=' . bnum2 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 3}), ! \ sign_getplaced(bnum1, {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.id != 6}), ! \ sign_getplaced(bnum2, {'group' : '*'})[0].signs) ! ! " Test for :sign unplace * buffer={nr} ! call Place_signs_for_test() ! exe 'sign unplace * buffer=' . bnum1 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.group != ''}), ! \ sign_getplaced(bnum1, {'group' : '*'})[0].signs) ! call assert_equal(signs2, sign_getplaced(bnum2, {'group' : '*'})[0].signs) ! ! " Test for :sign unplace * group={group} buffer={nr} ! call Place_signs_for_test() ! exe 'sign unplace * group=g1 buffer=' . bnum1 ! exe 'sign unplace * group=g2 buffer=' . bnum2 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.group != 'g1'}), ! \ sign_getplaced(bnum1, {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.group != 'g2'}), ! \ sign_getplaced(bnum2, {'group' : '*'})[0].signs) ! ! " Test for :sign unplace * group=* buffer={nr} ! call Place_signs_for_test() ! exe 'sign unplace * group=* buffer=' . bnum2 ! call assert_equal(signs1, sign_getplaced(bnum1, {'group' : '*'})[0].signs) ! call assert_equal([], sign_getplaced(bnum2, {'group' : '*'})[0].signs) ! ! " Test for :sign unplace {id} ! call Place_signs_for_test() ! sign unplace 4 ! sign unplace 6 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 4 || val.group != ''}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.id != 6 || val.group != ''}), ! \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! ! " Test for :sign unplace {id} group={group} ! call Place_signs_for_test() ! sign unplace 4 group=g1 ! sign unplace 6 group=g2 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 4 || val.group != 'g1'}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.id != 6 || val.group != 'g2'}), ! \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! ! " Test for :sign unplace {id} group=* ! call Place_signs_for_test() ! sign unplace 3 group=* sign unplace 5 group=* ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 3}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.id != 5}), ! \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! " Test for :sign unplace * ! call Place_signs_for_test() ! sign unplace * ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.group != ''}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.group != ''}), ! \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! ! " Test for :sign unplace * group={group} ! call Place_signs_for_test() ! sign unplace * group=g1 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.group != 'g1'}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal( ! \ filter(copy(signs2), ! \ {idx, val -> val.group != 'g1'}), ! \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! ! " Test for :sign unplace * group=* ! call Place_signs_for_test() sign unplace * group=* ! call assert_equal([], sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal([], sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! " Negative test cases ! call Place_signs_for_test() ! sign unplace 3 group=xy file=Xsign1 ! sign unplace * group=xy file=Xsign1 ! silent! sign unplace * group=* file=FileNotPresent ! call assert_equal(signs1, sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! call assert_equal(signs2, sign_getplaced('Xsign2', {'group' : '*'})[0].signs) ! ! " Tests for removing sign at the current cursor position ! ! " Test for ':sign unplace' ! let signs1 = [{'id' : 4, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g2', ! \ 'priority' : 10}, ! \ {'id' : 4, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g1', ! \ 'priority' : 10}, ! \ {'id' : 4, 'name' : 'sign1', 'lnum' : 13, 'group' : '', ! \ 'priority' : 10}, ! \ {'id' : 3, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g2', ! \ 'priority' : 10}, ! \ {'id' : 3, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g1', ! \ 'priority' : 10}, ! \ {'id' : 3, 'name' : 'sign1', 'lnum' : 13, 'group' : '', ! \ 'priority' : 10},] ! exe bufwinnr('Xsign1') . 'wincmd w' ! call cursor(13, 1) ! ! " Should remove only one sign in the global group ! call Place_signs_at_line_for_test() ! sign unplace ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 4 || val.group != ''}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! " Should remove the second sign in the global group ! sign unplace ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.group != ''}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! ! " Test for ':sign unplace group={group}' ! call Place_signs_at_line_for_test() ! " Should remove only one sign in group g1 ! sign unplace group=g1 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 4 || val.group != 'g1'}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! sign unplace group=g2 ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 4 || val.group == ''}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! ! " Test for ':sign unplace group=*' ! call Place_signs_at_line_for_test() ! sign unplace group=* ! sign unplace group=* ! sign unplace group=* ! call assert_equal( ! \ filter(copy(signs1), ! \ {idx, val -> val.id != 4}), ! \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs) ! sign unplace group=* ! sign unplace group=* ! sign unplace group=* ! call assert_equal([], sign_getplaced('Xsign1', {'group' : '*'})[0].signs) call sign_unplace('*') call sign_undefine() enew | only + call delete("Xsign1") + call delete("Xsign2") endfunc " Tests for auto-generating the sign identifier *************** *** 762,768 **** " Place three signs with different priority in the same line call writefile(repeat(["Sun is shining"], 30), "Xsign") edit Xsign - let fname = fnamemodify('Xsign', ':p') call sign_place(1, 'g1', 'sign1', 'Xsign', \ {'lnum' : 11, 'priority' : 50}) --- 1066,1071 ---- *** ../vim-8.1.0657/src/version.c 2018-12-29 13:09:43.242347695 +0100 --- src/version.c 2018-12-29 18:51:45.504342343 +0100 *************** *** 801,802 **** --- 801,804 ---- { /* Add new patch number below this line */ + /**/ + 658, /**/ -- hundred-and-one symptoms of being an internet addict: 76. Your ISP regards you as a business partner rather than as a customer. /// 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 ///