Skip to content

Commit 711a6c7

Browse files
committed
updated for version 7.3.596
Problem: Can't remove all signs for a file or buffer. Solution: Support "*" for the sign id. (Christian Brabandt)
1 parent 50bf8d5 commit 711a6c7

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

runtime/doc/sign.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,14 @@ REMOVING SIGNS *:sign-unplace* *E159*
153153
Remove the previously placed sign {id} from file {fname}.
154154
See remark above about {fname} |:sign-fname|.
155155

156+
:sign unplace * file={fname}
157+
Remove all placed signs in file {fname}.
158+
156159
:sign unplace {id} buffer={nr}
157-
Same, but use buffer {nr}.
160+
Remove the previously placed sign {id} from buffer {nr}.
161+
162+
:sign unplace * buffer={nr}
163+
Remove all placed signs in buffer {nr}.
158164

159165
:sign unplace {id}
160166
Remove the previously placed sign {id} from all files it

src/buffer.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ static void clear_wininfo __ARGS((buf_T *buf));
5757

5858
#if defined(FEAT_SIGNS)
5959
static void insert_sign __ARGS((buf_T *buf, signlist_T *prev, signlist_T *next, int id, linenr_T lnum, int typenr));
60-
static void buf_delete_signs __ARGS((buf_T *buf));
6160
#endif
6261

6362
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
@@ -5537,7 +5536,7 @@ buf_signcount(buf, lnum)
55375536
/*
55385537
* Delete signs in buffer "buf".
55395538
*/
5540-
static void
5539+
void
55415540
buf_delete_signs(buf)
55425541
buf_T *buf;
55435542
{

src/ex_cmds.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6997,6 +6997,16 @@ ex_sign(eap)
69976997
lnum = atoi((char *)arg);
69986998
arg = skiptowhite(arg);
69996999
}
7000+
else if (STRNCMP(arg, "*", 1) == 0 && idx == SIGNCMD_UNPLACE)
7001+
{
7002+
if (id != -1)
7003+
{
7004+
EMSG(_(e_invarg));
7005+
return;
7006+
}
7007+
id = -2;
7008+
arg = skiptowhite(arg + 1);
7009+
}
70007010
else if (STRNCMP(arg, "name=", 5) == 0)
70017011
{
70027012
arg += 5;
@@ -7033,7 +7043,7 @@ ex_sign(eap)
70337043
{
70347044
EMSG2(_("E158: Invalid buffer name: %s"), arg);
70357045
}
7036-
else if (id <= 0)
7046+
else if (id <= 0 && !(idx == SIGNCMD_UNPLACE && id == -2))
70377047
{
70387048
if (lnum >= 0 || sign_name != NULL)
70397049
EMSG(_(e_invarg));
@@ -7074,11 +7084,17 @@ ex_sign(eap)
70747084
}
70757085
else if (idx == SIGNCMD_UNPLACE)
70767086
{
7077-
/* ":sign unplace {id} file={fname}" */
70787087
if (lnum >= 0 || sign_name != NULL)
70797088
EMSG(_(e_invarg));
7089+
else if (id == -2)
7090+
{
7091+
/* ":sign unplace * file={fname}" */
7092+
redraw_buf_later(buf, NOT_VALID);
7093+
buf_delete_signs(buf);
7094+
}
70807095
else
70817096
{
7097+
/* ":sign unplace {id} file={fname}" */
70827098
lnum = buf_delsign(buf, id);
70837099
update_debug_sign(buf, lnum);
70847100
}

src/proto/buffer.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ int buf_findsign __ARGS((buf_T *buf, int id));
6060
int buf_findsign_id __ARGS((buf_T *buf, linenr_T lnum));
6161
int buf_findsigntype_id __ARGS((buf_T *buf, linenr_T lnum, int typenr));
6262
int buf_signcount __ARGS((buf_T *buf, linenr_T lnum));
63+
void buf_delete_signs __ARGS((buf_T *buf));
6364
void buf_delete_all_signs __ARGS((void));
6465
void sign_list_placed __ARGS((buf_T *rbuf));
6566
void sign_mark_adjust __ARGS((linenr_T line1, linenr_T line2, long amount, long amount_after));

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ static char *(features[]) =
714714

715715
static int included_patches[] =
716716
{ /* Add new patch number below this line */
717+
/**/
718+
596,
717719
/**/
718720
595,
719721
/**/

0 commit comments

Comments
 (0)